Skip to content

Fix flaky RuntimeScriptInjectionTests.PathBase (static-state test isolation) - #2

Merged
pal-tamas merged 2 commits into
mainfrom
fix/pathbase-runtime-script-test-isolation
May 29, 2026
Merged

Fix flaky RuntimeScriptInjectionTests.PathBase (static-state test isolation)#2
pal-tamas merged 2 commits into
mainfrom
fix/pathbase-runtime-script-test-isolation

Conversation

@pal-tamas

Copy link
Copy Markdown
Owner

What

RuntimeScriptInjectionTests.PathBase_PrefixesInjectedRuntimeScriptSrc is order-dependent and flaky in CI (failed, passed, failed across three identical re-runs of main). It asserts the injected runtime <script> src carries the host's pathBase, but that value is read from the process-wide LiveOptions.PathBase static at render time. When another host (e.g. PathBaseEndpointTests) configures UseRask/AddRask concurrently, it clobbers the static mid-render and flips the assertion.

Fix

Move the test into the existing non-parallel ScopedAssets collection (DisableParallelization=true) — the same one PathBaseEndpointTests already uses — so no competing host mutates the static while it runs. Matches the established precedent for PathBase tests; LiveOptions.PathBase stays a static by design (read on every render, no DI in the hot path).

Note on the E2E failures

The same CI runs also show ~10-11 StandaloneWasmExampleTests failures (all CodeSample / scoped-JS pages). Those are not addressed here: the full E2E suite passes 451/451 locally under identical full-parallel config, the failing set shifts run-to-run, and it's confined to the slowest browser fixture (WasmAppHost) + the timing-sensitive scoped-JS feature — i.e. CI resource-contention timing, not a logic bug. Tracking separately.

pal-tamas added 2 commits May 29, 2026 13:24
PathBase_PrefixesInjectedRuntimeScriptSrc asserts on the host pathBase,
which the injected runtime script reads from the process-wide
LiveOptions.PathBase static at render time. Run concurrently with another
host (e.g. PathBaseEndpointTests), a competing UseRask/AddRask clobbers
that static mid-render and flips the assertion -- the test failed, passed,
then failed again across three identical CI runs.

Move it into the existing non-parallel ScopedAssets collection (same one
PathBaseEndpointTests already uses) so no other host configures the static
concurrently. Matches the established precedent for PathBase tests.
The PathBase commit added a 4th browser-host collection fixture
(SubPathWasmAppFixture) alongside Server, Wasm.Host, and StandaloneWasm.
xunit ran all four collections concurrently, and on the 2-core CI runner
that over-subscribed CPU and starved the slowest fixture -- StandaloneWasm
(WasmAppHost cold boot). Its CodeSample pages then missed the deferred
scoped-JS highlight window, so the Highlight/ScopedJs/Memory/Validation
tests timed out with "no code blocks found" (total==0). The failing set
shifted run-to-run (11/10/11) and only ever hit StandaloneWasm -- the
signature of resource contention, not a logic bug. The full suite passes
451/451 locally where multi-core boxes have the headroom.

Add xunit.runner.json (maxParallelThreads=2, conservative algorithm),
copied to output via the csproj, so the runner caps concurrency and the
CI runner behaves like a local box.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant