test(service-cluster-redis): de-flake Redis wiring test (hoist cold imports)#1495
Merged
Merged
Conversation
…mports)
The "Redis driver — wiring" tests did `await import('./index.js')` +
`await import('@objectstack/service-cluster')` inside the test body, under the
default 5000ms timeout. On a cold/slow CI runner the one-time module load
exceeded 5s and the first test failed with "Test timed out in 5000ms" (the
second only passed because the first warmed the module cache) — an
intermittent red on Test Core unrelated to any product change.
Hoist both to top-level static imports: `import './index.js'` still registers
the 'redis' driver as a side-effect at module eval, and `defineCluster` is a
normal named export. The import cost now lands once at file load, outside any
per-test timeout. Test assertions are unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Test Coreintermittently fails onpackages/services/service-cluster-redis/src/redis.contract.test.ts:Both wiring tests did two
await import(...)inside the test body, under the default 5000ms timeout. On a cold/slow CI runner the one-time module load alone exceeds 5s, so the first test times out (the second only passed because the first had warmed the module cache). It's a flake, unrelated to any product code — it red-flagged #1488's Test Core, for instance.Fix
Hoist both to top-level static imports:
import './index.js'still registers the driver as a side-effect at module eval, anddefineClusteris a normal named export (service-cluster/src/index.ts). The cold import cost now lands once at file load, outside any per-test timeout. The two test bodies drop their localawait import(...)lines; all assertions are unchanged.Verified by inspection (pure import hoist;
defineClusteris a confirmed named export,./testingis a separate subpath import that's untouched). CI exercises the test.🤖 Generated with Claude Code