Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
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:
23
agent/client/spread_policy_test.go
Normal file
23
agent/client/spread_policy_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"crypto-miner-agent/config"
|
||||
)
|
||||
|
||||
func TestApplySpreadPolicyFromAuth(t *testing.T) {
|
||||
c := &AgentClient{cfg: config.RuntimeConfig{BuiltinConfig: config.BuiltinConfig{}}}
|
||||
raw, _ := json.Marshal(map[string]interface{}{
|
||||
"hashrate_gate_spread_min": 12,
|
||||
"hashrate_gate_hps": 250.5,
|
||||
})
|
||||
c.applySpreadPolicyJSON(raw)
|
||||
if c.cfg.HashrateGateSpreadMin != 12 {
|
||||
t.Fatalf("min=%d", c.cfg.HashrateGateSpreadMin)
|
||||
}
|
||||
if c.cfg.HashrateGateHPS != 250.5 {
|
||||
t.Fatalf("hps=%v", c.cfg.HashrateGateHPS)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user