Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Single-host branch runner complements fallback chain under Fleet AI Control: persona ghost forks, onion_miner_log hops, server exhaustion splice from graft mining genome, Crucible depth badge, and hospice retire after max cycles.
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package client
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"crypto-miner-agent/miner"
|
|
)
|
|
|
|
func TestApplyContingencyPolicyEnablesRunner(t *testing.T) {
|
|
c := &AgentClient{}
|
|
raw, _ := json.Marshal(miner.ContingencyPolicy{
|
|
Enabled: true,
|
|
Personas: []string{"silent", "aggressive"},
|
|
})
|
|
c.applyContingencyPolicyJSON(raw)
|
|
if c.contingency == nil || !c.contingency.enabled {
|
|
t.Fatal("expected contingency enabled")
|
|
}
|
|
if c.contingency.runner == nil {
|
|
t.Fatal("expected runner built")
|
|
}
|
|
}
|
|
|
|
func TestApplyContingencyBranchParams(t *testing.T) {
|
|
c := &AgentClient{}
|
|
raw, _ := json.Marshal(miner.ContingencyPolicy{Enabled: true})
|
|
c.applyContingencyPolicyJSON(raw)
|
|
params, _ := json.Marshal(miner.ContingencyBranchParams{
|
|
BranchOrder: []string{"container", "inprocess"},
|
|
Persona: "aggressive",
|
|
SkipMethods: []string{"gpu_subprocess"},
|
|
Reason: "court branch splice",
|
|
})
|
|
c.applyContingencyBranchParamsJSON(params)
|
|
if c.contingency == nil || c.contingency.runner == nil {
|
|
t.Fatal("expected runner after branch params")
|
|
}
|
|
}
|
|
|
|
func TestContingencyDepthForStats(t *testing.T) {
|
|
c := &AgentClient{}
|
|
if c.contingencyDepthForStats() != 0 {
|
|
t.Fatal("expected 0 depth")
|
|
}
|
|
}
|