Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

This commit is contained in:
AetherForge
2026-06-07 04:58:55 -07:00
parent b2a7b1723f
commit 7b2d41cda8
118 changed files with 9938 additions and 223 deletions

View File

@@ -3,7 +3,8 @@ param(
[switch]$SkipE2E,
[switch]$SkipBuild,
[switch]$Verbose,
[switch]$ReconOnly
[switch]$ReconOnly,
[switch]$P2
)
$ErrorActionPreference = "Stop"
@@ -32,7 +33,7 @@ function Invoke-Npm([string[]]$NpmArgs) {
$out = & npm @NpmArgs 2>&1 | ForEach-Object { "$_" }
$text = ($out -join "`n").Trim()
if ($text) { Write-Host $text }
if (-not $LASTEXITCODE -or $LASTEXITCODE -eq 0) { return }
if (-not $LASTEXITCODE -or $LASTEXITCODE -eq 0) { $global:LASTEXITCODE = 0; return }
throw "npm $($NpmArgs -join ' ') failed (exit $LASTEXITCODE)"
} finally {
$ErrorActionPreference = $prevEAP
@@ -46,7 +47,7 @@ function Invoke-GoTest([string]$Package) {
$out = go test $Package -count=1 2>&1 | ForEach-Object { "$_" }
$text = ($out -join "`n").Trim()
if ($text) { Write-Host $text }
if (-not $LASTEXITCODE -or $LASTEXITCODE -eq 0) { return }
if (-not $LASTEXITCODE -or $LASTEXITCODE -eq 0) { $global:LASTEXITCODE = 0; return }
# Windows AV occasionally locks *.test.exe after an otherwise passing run.
if ($text -match 'unlinkat.*\.test\.exe') {
Write-Host " >> (ignored test binary cleanup flake on Windows for $Package)" -ForegroundColor Yellow
@@ -78,6 +79,26 @@ Write-Host ""
Write-Host " AetherForge Full Test Suite" -ForegroundColor Yellow
Write-Host " Root: $Root"
if ($P2) {
Invoke-Phase "P2 focused (mining, spread, path forge, WS/beacon)" {
Push-Location (Join-Path $Root "server")
go test ./internal/api/... ./internal/builder/... -run "SpreadLane|WSBeacon|PathForge|Download|SpreadCred" -count=1
Pop-Location
Push-Location (Join-Path $Root "agent")
go test ./client/... -run "MiningChain|WSBeacon|PathTracer" -count=1
go test ./deploy/... -run "WinRM|Spread|Staging|LinuxLOTL" -count=1
go test ./miner/... -run "Fallback|TripleOnion" -count=1
Pop-Location
Push-Location (Join-Path $Root "server\web")
if (-not (Test-Path "node_modules")) { npm install --silent }
npm run test -- --run src/pages/BuilderPage.test.tsx src/help/spreadProfiles.test.ts src/help/lotlOnionTiers.test.ts
Pop-Location
}
Write-Host ""
Write-Host " P2-only run complete (run full suite phase 8 for Playwright E2E)" -ForegroundColor Green
exit 0
}
if ($ReconOnly) {
Invoke-Phase "Fleet recon (focused)" {
Push-Location (Join-Path $Root "server")
@@ -229,7 +250,12 @@ if (-not $SkipE2E) {
$env:AETHERFORGE_URL = "http://127.0.0.1:18989"
$env:AETHERFORGE_FLEET_SECRET = $fleetSecret
npx playwright install chromium 2>$null | Out-Null
npx playwright test --config playwright.config.ts
$prevEAP = $ErrorActionPreference
$ErrorActionPreference = 'Continue'
try {
& npx playwright test --config playwright.config.ts 2>&1 | ForEach-Object { "$_" } | Write-Host
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) { throw "playwright test failed (exit $LASTEXITCODE)" }
} finally { $ErrorActionPreference = $prevEAP }
Pop-Location
} finally {
if ($proc -and -not $proc.HasExited) {