Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
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.
30 lines
848 B
Go
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)
|
|
}
|
|
}
|