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