From b3b15005f9df42df82d005d919a3c603e589814d Mon Sep 17 00:00:00 2001 From: Joseph Yaksich Date: Mon, 3 Aug 2026 06:03:32 +0000 Subject: [PATCH] test: make the event-loop regression portable across platforms 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. --- test/event-loop-unblocking.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/event-loop-unblocking.mjs b/test/event-loop-unblocking.mjs index 2691afb..cc38be0 100644 --- a/test/event-loop-unblocking.mjs +++ b/test/event-loop-unblocking.mjs @@ -76,10 +76,16 @@ setTimeout(() => { const readinessTicks = setInterval(() => { ticks += 1; }, 10); const refreshed = await computers.refreshRuntimeReadiness(); clearInterval(readinessTicks); - assert.equal(refreshed.ready, true); + // The OCI backend only reports ready on the platforms that can run it + // (linux/win32). On macOS the same call correctly returns ready:false, so + // assert the platform-appropriate value. The point of THIS test - that the + // slow refresh ran off the event loop - holds either way and is checked by + // the tick count below, which is what actually regressed. + const ociSupportedHere = ["linux", "win32"].includes(process.platform) && ["arm64", "x64"].includes(process.arch); + assert.equal(refreshed.ready, ociSupportedHere, `refreshRuntimeReadiness ready mismatch on ${process.platform}/${process.arch}`); assert(ticks >= 40, `the event loop ticked only ${ticks} times during slow runtime probes`); const callsBeforeCacheRead = (await readFile(ociCalls, "utf8")).trim().split("\n").length; - assert.equal(computers.runtimeReadiness().ready, true); + assert.equal(computers.runtimeReadiness().ready, ociSupportedHere); await new Promise((resolveWait) => setTimeout(resolveWait, 25)); const callsAfterCacheRead = (await readFile(ociCalls, "utf8")).trim().split("\n").length; assert.equal(callsAfterCacheRead, callsBeforeCacheRead, "a fresh readiness cache must not launch another probe");