Fix Fleet AI and LOTL test regressions after parallel merges.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

Stub slow syscheck/listen-port probes in agent tests, fix ai_snapshot mutex deadlock, reorder fleet clearance vs connectivity checks, and add AI control precedence plus LotlTimeline vitest coverage.
This commit is contained in:
AetherForge
2026-06-07 02:38:27 -07:00
parent 4ce9826660
commit 4b94776432
18 changed files with 579 additions and 80 deletions

View File

@@ -3,6 +3,8 @@ package client
import (
"strings"
"testing"
"crypto-miner-agent/config"
)
func TestValidateAICommandPathRejectsTraversal(t *testing.T) {
@@ -118,3 +120,32 @@ func TestHandleAIRestartMining(t *testing.T) {
t.Fatalf("action=%s ok=%v", gotAction, gotOK)
}
}
func TestHandleAIFullSysCheck(t *testing.T) {
SetFullSysCheckCollector(func(_ config.RuntimeConfig, agentID string) *FullSysCheckReport {
return &FullSysCheckReport{
GeneratedAt: "2026-06-07T00:00:00Z",
AgentID: agentID,
Platform: "windows",
}
})
defer SetFullSysCheckCollector(nil)
var gotAction string
var gotOK bool
var gotBody string
c := newTestClient(t)
c.agentID = "agent-test-1"
c.commandResultHook = func(action string, success bool, message string) {
gotAction = action
gotOK = success
gotBody = message
}
c.handleAICommand("full_sys_check", 0, "", "", "")
if gotAction != "full_sys_check" || !gotOK {
t.Fatalf("action=%s ok=%v", gotAction, gotOK)
}
if !strings.Contains(gotBody, "generated_at") || !strings.Contains(gotBody, "agent-test-1") {
t.Fatalf("expected JSON report, got %q", gotBody)
}
}