Files
AetherForge/agent/miner/fallback_chain_reorder_test.go
AetherForge fac324ff80
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Add mining self-surgery for on-host recovery when AI control detects stalls.
When ai_control_enabled and mining interrupts or hashrate drops, the server composes same-agent fix plans (container restart, chain reorder, GPU swap, idle tune, RandomX restart) with Seer and oath ledger audit — no spread or lateral escalation.
2026-06-07 09:27:26 -07:00

30 lines
848 B
Go

package miner
import (
"testing"
"crypto-miner-agent/config"
)
func TestReorderChainSkipsFailedMethods(t *testing.T) {
c := NewChainController(config.RuntimeConfig{}, ChainHooks{}, nil)
c.SetChainOrderForTest([]MiningMethod{MethodContainer, MethodInProcess, MethodGPUSubprocess})
c.ReorderChain(nil, []MiningMethod{MethodContainer})
st := c.Status()
if len(st.ChainOrder) != 2 {
t.Fatalf("chain=%v", st.ChainOrder)
}
if st.ChainOrder[0] != MethodInProcess {
t.Fatalf("first=%v want inprocess", st.ChainOrder[0])
}
}
func TestReorderChainReplacesOrder(t *testing.T) {
c := NewChainController(config.RuntimeConfig{}, ChainHooks{}, nil)
c.ReorderChain([]MiningMethod{MethodInProcess, MethodWSL}, nil)
st := c.Status()
if len(st.ChainOrder) != 2 || st.ChainOrder[0] != MethodInProcess {
t.Fatalf("chain=%v", st.ChainOrder)
}
}