Add simple Deploy and Mine path for operators without spread complexity.
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
Skips triple-onion deploy lanes for simple_deploy forges, restarts mining after auth with server policy, and surfaces connected-but-not-hashing fixes on Dashboard and Crucible.
This commit is contained in:
63
agent/client/simple_deploy_test.go
Normal file
63
agent/client/simple_deploy_test.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"crypto-miner-agent/miner"
|
||||
)
|
||||
|
||||
func TestWireTripleOnionNilWhenSimpleDeploy(t *testing.T) {
|
||||
setupNoContainerRuntime(t)
|
||||
cfg := baseMiningCfg()
|
||||
cfg.SimpleDeploy = true
|
||||
c := miningChainTestClient(t, cfg)
|
||||
r := c.newMiningChainRunner()
|
||||
if r.onion != nil {
|
||||
t.Fatal("expected nil triple onion when SimpleDeploy baked")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSimpleDeployPolicySkipsTripleOnion(t *testing.T) {
|
||||
setupNoContainerRuntime(t)
|
||||
c := miningChainTestClient(t, baseMiningCfg())
|
||||
raw, _ := json.Marshal(miner.SimpleDeployTripleOnionPolicy())
|
||||
c.applyTripleOnionPolicyJSON(raw)
|
||||
r := c.newMiningChainRunner()
|
||||
if r.onion != nil {
|
||||
t.Fatal("expected nil triple onion when server simple_deploy policy applied")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSimpleDeployWaitsForC2BeforeMining(t *testing.T) {
|
||||
setupNoContainerRuntime(t)
|
||||
cfg := baseMiningCfg()
|
||||
cfg.SimpleDeploy = true
|
||||
c := miningChainTestClient(t, cfg)
|
||||
c.miningChain = newTestMiningChainRunner(t, c)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Millisecond)
|
||||
defer cancel()
|
||||
go c.startMiningWhenReady(ctx)
|
||||
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
if r := c.miningChain.Status(); r.ActiveMethod != "" {
|
||||
t.Fatalf("simple deploy should wait for C2 before starting, active=%q", r.ActiveMethod)
|
||||
}
|
||||
|
||||
c.connected.Store(true)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
|
||||
func TestKickMiningAfterAuthSkipsSimpleDeploy(t *testing.T) {
|
||||
setupNoContainerRuntime(t)
|
||||
cfg := baseMiningCfg()
|
||||
cfg.SimpleDeploy = true
|
||||
c := miningChainTestClient(t, cfg)
|
||||
c.miningChain = newTestMiningChainRunner(t, c)
|
||||
c.miningCtx = context.Background()
|
||||
// must not panic or restart when simple deploy
|
||||
c.kickMiningAfterAuth()
|
||||
}
|
||||
Reference in New Issue
Block a user