Skip to content

test(worker): scope Alpine-container Node tests to X64 builds - #234

Closed
florentianayuwono wants to merge 2 commits into
mainfrom
fix/alpine-container-tests-x64-only-isd-5856
Closed

florentianayuwono wants to merge 2 commits into
mainfrom
fix/alpine-container-tests-x64-only-isd-5856

Conversation

@florentianayuwono

Copy link
Copy Markdown

Summary

Three L0 tests in StepHostL0.cs (DetermineNodeRuntimeVersionInAlpineContainerAsync, DetermineNode20RuntimeVersionInAlpineContainerAsync, DetermineNode24RuntimeVersionInAlpineContainerAsync) fail deterministically whenever the Test assembly is built natively on linux-arm64. This surfaced in #233's CI run once the dead L0-test matrix condition there was fixed and dotnet test actually ran on the linux-arm64 leg for the first time.

Root cause

StepHost.CheckPlatformForAlpineContainer gates Alpine Node support with:

if (!Constants.Runner.PlatformArchitecture.Equals(Constants.Architecture.X64))
{
    throw new NotSupportedException(...);
}

Constants.Runner.PlatformArchitecture is not detected at runtime — it's baked in at compile time via #if X86/#if ARM/#if ARM64/else directives in Constants.cs, driven by the X64/ARM/ARM64 preprocessor symbols that Directory.Build.props sets from the PackageRuntime MSBuild property.

./dev.sh test auto-detects the host architecture (via uname -m) and sets PackageRuntime accordingly when no explicit target runtime is passed. On a linux-arm64 self-hosted runner, that means the Test assembly is built with PackageRuntime=linux-arm64, the ARM64 symbol is defined, and PlatformArchitecture compiles to Arm64 — so CheckPlatformForAlpineContainer always throws, regardless of what the test is actually trying to verify. This is 100% reproducible, not flaky, and is unrelated to the actual Alpine-container Node-version-detection logic the tests exercise.

This was previously invisible because the build.yml L0-test-trigger condition was dead (see #233), so the test step never actually executed on the linux-arm64 matrix leg.

Fix

Gate the three Alpine-container tests with #if X64, matching the production code's own intentional X64-only restriction for Alpine support. They now only compile/run as part of an X64-targeted Test assembly build, which is the only configuration where the behavior they exercise is actually reachable.

Testing

  • ./dev.sh test — full local suite builds and runs cleanly (one unrelated pre-existing local-environment failure in ProcessExtensionL0.SuccessReadProcessEnv, caused by a missing cached node20 external in this sandbox, not by this change).
  • dotnet test --filter "FullyQualifiedName~StepHostL0|FullyQualifiedName~JobExtensionL0" — 41/41 passed.

florentianayuwono and others added 2 commits October 7, 2026 00:42
StepHost.CheckPlatformForAlpineContainer gates Alpine Node support on
Constants.Runner.PlatformArchitecture.Equals(Constants.Architecture.X64).
That value is baked in at compile time via the X64/ARM/ARM64
preprocessor symbols (set from the PackageRuntime MSBuild property),
not detected at test-runtime.

When the Test assembly is built natively on a linux-arm64 self-hosted
runner (no explicit PackageRuntime override), PlatformArchitecture
compiles to Arm64, so these three tests deterministically throw
NotSupportedException instead of exercising the Alpine-specific
behavior they were written for. This was previously invisible because
a dead matrix condition in build.yml meant the L0 test step never
actually ran on the linux-arm64 leg.

Gate the three Alpine-container tests with #if X64 so they only
compile/run against X64-targeted Test assembly builds, matching the
production code's own intentional restriction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The 'L0' step's condition compared matrix.runtime (always 'linux-*'-
prefixed, e.g. 'linux-x64', 'linux-arm64') against bare arch names
('arm64', 'amd64') that only ever appear in the separate matrix.runs_on
field. This mismatch meant the condition never evaluated true for any
matrix leg, so ./dev.sh test has silently never run as part of this
workflow, on any architecture, on PRs or pushes.

Compared against upstream actions/runner's build.yml to confirm intent:
upstream runs L0 on every runtime except the ones that can't execute
natively on its GitHub-hosted runners (linux-arm64, linux-arm, osx-arm64,
win-arm64, since those jobs run cross-compiled on amd64 hosts). This
fork instead builds each target on matching self-hosted native hardware
(runs-on: matrix.runs_on), so linux-arm64 can safely run its own tests
directly, unlike upstream.

Fix: compare against the correct matrix.runtime values and enable L0 for
linux-x64 and linux-arm64 (native, unpatched builds). linux-arm (32-bit
armv7l, cross-targeted), ppc64le, and s390x are intentionally left
disabled for now -- they require their respective patches applied first,
and their dotnet-test behavior under cross/32-bit targeting is not yet
validated. Enabling genuine L0 coverage for those is tracked as separate
follow-up work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@florentianayuwono

Copy link
Copy Markdown
Author

Consolidating this fix directly into #233 so CI goes green in one PR (this fix needed #233's build.yml matrix-condition change to actually exercise dotnet test on linux-arm64 anyway). Closing in favor of #233.

@florentianayuwono
florentianayuwono deleted the fix/alpine-container-tests-x64-only-isd-5856 branch October 6, 2026 18:10
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