Fix install-script E2E flakiness and re-add to Windows gate
Summary
Fix two pre-existing test-quality bugs that kept TentacleInstallScriptE2E red on the windows-latest (Administrator) runner — surfaced by the new Windows smoke gate (#407/#408), and red on every push to main before that.
-
UAC tests (3
TentacleUacElevationE2ETests) — two compounding causes:-
install-tentacle.ps1defined its own script-localTest-IsAdministrator, which shadowed the test's parent-scopefunction global:mock → on an admin host the real check returned$trueand elevation was skipped. Fix: guard the definition (if (-not (Test-Path Function:\...))) so an ambient mock wins. -
Root cause of the exit-99 mismatch (verified locally with PowerShell): the wrapper invokes the script via the call operator (
& script.ps1), andexit Ninside a&-invoked script sets$LASTEXITCODEbut not the wrapper process's exit code — so the mocked elevation exit (99) was lost and the assertion read 0. The mock was working; this was never a mock-interception problem. Fix: the wrapper ends withexit $LASTEXITCODE.
- Also factor the elevation launch into a guard-defined
Invoke-UacRelaunchseam the test overrides, instead of mocking the built-inStart-Processcmdlet — a cleaner, less fragile seam.
-
-
install-info parallel race (
TentacleInstallScript*E2ETests) — the script writesinstall-info.jsonto the shared canonical%ProgramData%\Squid\Tentacle\, so install-script test classes running in parallel clobbered each other's file. Fix: redirect the child's%ProgramData%to a per-test temp dir viaProcessStartInfo, mirroringTentacleUpgradeLifecycleE2ETests. -
Re-add
TentacleInstallScriptE2Eto the Windows smoke gate (tentacle-windows-smoke-e2e.yml): both filter defaults + the detect job's path match.
Production change (install-tentacle.ps1) is non-breaking: normal installs have no ambient function override and behave identically. The versioned-layout drift detector is unaffected (it pins the extract/swap region, not the elevation path).
Test plan
-
Root cause reproduced + fix verified locally on PowerShell ( exit $LASTEXITCODEpropagates the&-invoked script's exit) -
Category=TentacleInstallScriptE2Edispatched onwindows-latest: 15/15 green (was 12/15, then 3 UAC failing) -
C# compiles clean; brace balance + drift detector verified -
This PR's gate run exercises the full 6-category default filter (69 tests) on windows-latestand goes green -
tests.yml(unit + Tentacle drift detector + integration) green