Extend agent tests for cloud fleet features and erasure lanes.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Cover fleet torrent DHT fetch, cloud map/venue/meta IMDS mocks, S3 shard fetch order, zero-server policy polling, self-surgery reorder, contingency skip paths, epidemiology fix guards, and ssm_document deploy lane.
This commit is contained in:
@@ -49,6 +49,34 @@ func TestZeroServerPolicyModePrefersRelayPoll(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestZeroServerPolicyModeFallsBackToReconnect(t *testing.T) {
|
||||
var polls atomic.Int32
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
polls.Add(1)
|
||||
}))
|
||||
defer srv.Close()
|
||||
cfg := config.RuntimeConfig{}
|
||||
StartZeroServerPolicyMode(cfg, func() error { return nil })
|
||||
time.Sleep(120 * time.Millisecond)
|
||||
if polls.Load() != 0 {
|
||||
t.Fatalf("expected no relay poll without URL, got %d", polls.Load())
|
||||
}
|
||||
}
|
||||
|
||||
func TestZeroServerPolicyModeUsesPollURLWhenRelayEmpty(t *testing.T) {
|
||||
var polls atomic.Int32
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
polls.Add(1)
|
||||
_ = json.NewEncoder(w).Encode(PolicySnapshotBody{GenesisVersion: 2})
|
||||
}))
|
||||
defer srv.Close()
|
||||
cfg := config.RuntimeConfig{}
|
||||
cfg.PolicySnapshotPollURL = srv.URL
|
||||
StartZeroServerPolicyMode(cfg, func() error { return nil })
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
if polls.Load() < 1 {
|
||||
t.Fatal("expected poll URL fetch")
|
||||
}
|
||||
if PolicyGenesisVersion() != 2 {
|
||||
t.Fatalf("genesis=%d", PolicyGenesisVersion())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user