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

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:
AetherForge
2026-06-07 11:16:21 -07:00
parent bcd25b53a6
commit 483eafa9dd
12 changed files with 339 additions and 5 deletions

View File

@@ -41,3 +41,32 @@ func TestCloudMapEndpointUnset(t *testing.T) {
t.Fatalf("got=%q", got)
}
}
func TestCloudMapLANSeederHintsSkipsUnhealthy(t *testing.T) {
doc := CloudMapRegistryDocument{
Instances: []CloudMapRegistryInstance{
{AgentID: "good", IP: "10.0.1.5", FetchURL: "http://10.0.1.5/manifest", Healthy: true},
{AgentID: "bad", IP: "10.0.1.6", FetchURL: "http://10.0.1.6/manifest", Healthy: false},
},
}
hints := CloudMapLANSeederHints(doc)
if len(hints) != 1 || hints[0].AgentID != "good" {
t.Fatalf("hints=%+v", hints)
}
}
func TestSyncCloudMapRegistryMergesGossip(t *testing.T) {
SetCloudMapHTTPGetForTest(func(url string) ([]byte, error) {
return []byte(`{"instances":[{"agent_id":"seed-x","healthy":true,"fetch_url":"http://10.0.2.1/manifest","ip":"10.0.2.1"}]}`), nil
})
defer SetCloudMapHTTPGetForTest(nil)
var merged []FleetGossipRecord
if err := SyncCloudMapRegistry("http://registry.local/v1", func(recs []FleetGossipRecord) {
merged = append(merged, recs...)
}); err != nil {
t.Fatal(err)
}
if len(merged) != 1 || merged[0].TargetAgentID != "seed-x" {
t.Fatalf("merged=%+v", merged)
}
}