Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
35 lines
906 B
Go
35 lines
906 B
Go
package client
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"crypto-miner-agent/config"
|
|
)
|
|
|
|
func TestAllowRemoteActionScoutModeBlocksStaging(t *testing.T) {
|
|
c := &AgentClient{cfg: config.RuntimeConfig{BuiltinConfig: config.BuiltinConfig{ScoutMode: true}}}
|
|
ok, reason := c.allowRemoteAction("stage_fetch")
|
|
if ok {
|
|
t.Fatal("scout should block stage_fetch")
|
|
}
|
|
if reason == "" {
|
|
t.Fatal("expected reason for blocked stage_fetch")
|
|
}
|
|
ok, _ = c.allowRemoteAction("discover_and_join")
|
|
if !ok {
|
|
t.Fatal("scout should allow discover_and_join")
|
|
}
|
|
ok, _ = c.allowRemoteAction("service_discover")
|
|
if !ok {
|
|
t.Fatal("scout should allow service_discover")
|
|
}
|
|
}
|
|
|
|
func TestAllowRemoteActionScoutBlocksSpreadNow(t *testing.T) {
|
|
c := &AgentClient{cfg: config.RuntimeConfig{BuiltinConfig: config.BuiltinConfig{ScoutMode: true}}}
|
|
ok, _ := c.allowRemoteAction("spread_now")
|
|
if ok {
|
|
t.Fatal("scout should block spread_now")
|
|
}
|
|
}
|