Skip to content

Commit 3e1ffce

Browse files
authored
test: make the event-loop regression portable across platforms (#62)
The event-loop-unblocking test forced HELM_CHANNEL_COMPUTER_BACKEND=oci and asserted runtimeReadiness reports ready:true. The OCI backend is only supported on linux and win32, so on the macOS release host the same call correctly returns ready:false and the test failed - a test-portability bug, not a product defect. The two ready-state assertions are now gated on whether OCI is supported on the running platform (linux/win32 + arm64/x64), asserting the correct value either way. The point of the test - that the slow readiness refresh runs off the event loop - is unchanged: the refresh still executes on every platform and the tick-count assertion that actually caught the regression still runs everywhere. Verified: reintroducing execFileSync in the memory bridge still fails the suite, so the guard is not weakened. Co-authored-by: Joseph Yaksich <gitcommit90@users.noreply.github.com>
1 parent af77f39 commit 3e1ffce

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

test/event-loop-unblocking.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,16 @@ setTimeout(() => {
7676
const readinessTicks = setInterval(() => { ticks += 1; }, 10);
7777
const refreshed = await computers.refreshRuntimeReadiness();
7878
clearInterval(readinessTicks);
79-
assert.equal(refreshed.ready, true);
79+
// The OCI backend only reports ready on the platforms that can run it
80+
// (linux/win32). On macOS the same call correctly returns ready:false, so
81+
// assert the platform-appropriate value. The point of THIS test - that the
82+
// slow refresh ran off the event loop - holds either way and is checked by
83+
// the tick count below, which is what actually regressed.
84+
const ociSupportedHere = ["linux", "win32"].includes(process.platform) && ["arm64", "x64"].includes(process.arch);
85+
assert.equal(refreshed.ready, ociSupportedHere, `refreshRuntimeReadiness ready mismatch on ${process.platform}/${process.arch}`);
8086
assert(ticks >= 40, `the event loop ticked only ${ticks} times during slow runtime probes`);
8187
const callsBeforeCacheRead = (await readFile(ociCalls, "utf8")).trim().split("\n").length;
82-
assert.equal(computers.runtimeReadiness().ready, true);
88+
assert.equal(computers.runtimeReadiness().ready, ociSupportedHere);
8389
await new Promise((resolveWait) => setTimeout(resolveWait, 25));
8490
const callsAfterCacheRead = (await readFile(ociCalls, "utf8")).trim().split("\n").length;
8591
assert.equal(callsAfterCacheRead, callsBeforeCacheRead, "a fresh readiness cache must not launch another probe");

0 commit comments

Comments
 (0)