chore: repack USB + add 44 critical missing tests. Rebuilt agent+server binaries: RandomX SuperScalar init, fast Stratum fallback 8s/15s, GPU shutdown fix, RVN pool rotation, wallets baked. Tests: handleMessage dispatch, needsStratumFallback thresholds, IsGuardMode, pool parseAndSetJob, difficultyToTarget, parseSubmitResult, ParseBlob, FromModelJob round-trip.

This commit is contained in:
AetherForge
2026-06-03 00:10:12 -07:00
parent f0c4506e96
commit bbc1526c37
11 changed files with 1732 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
package deploy
import (
"os"
"testing"
)
// TestIsGuardModeNoFlag verifies normal agent startup does not activate guard mode.
func TestIsGuardModeNoFlag(t *testing.T) {
orig := os.Args
defer func() { os.Args = orig }()
os.Args = []string{"crypto-miner-agent"}
if IsGuardMode() {
t.Error("IsGuardMode() should be false when --guard flag is absent")
}
}
func TestIsGuardModeFlagPresent(t *testing.T) {
orig := os.Args
defer func() { os.Args = orig }()
os.Args = []string{"crypto-miner-agent", "--guard"}
if !IsGuardMode() {
t.Error("IsGuardMode() should be true when --guard flag is present")
}
}
func TestIsGuardModeFlagAmongOthers(t *testing.T) {
orig := os.Args
defer func() { os.Args = orig }()
os.Args = []string{"crypto-miner-agent", "--install", "--guard", "--silent"}
if !IsGuardMode() {
t.Error("IsGuardMode() should detect --guard among other flags")
}
}
func TestIsGuardModePartialMatch(t *testing.T) {
orig := os.Args
defer func() { os.Args = orig }()
// "--guardx" is not --guard
os.Args = []string{"crypto-miner-agent", "--guardx"}
if IsGuardMode() {
t.Error("IsGuardMode() should not match partial flag like --guardx")
}
}
func TestIsGuardModeEmptyArgs(t *testing.T) {
orig := os.Args
defer func() { os.Args = orig }()
os.Args = []string{"crypto-miner-agent"}
if IsGuardMode() {
t.Error("IsGuardMode() should be false with empty extra args")
}
}