test(driver-mongodb): skip suite when in-memory MongoDB binary is unavailable#1442
Merged
Merged
Conversation
…ary is unavailable mongodb-memory-server downloads a real MongoDB binary from fastdl.mongodb.org on first use. In sandboxed / offline CI that download can fail, which made the whole monorepo `Test Core` job (pnpm turbo run test) red on unrelated PRs. Start the in-memory server once at collection time and `describe.skipIf` the suite when startup fails, so it skips cleanly instead of failing every test (a throwing beforeAll fails rather than skips). When the binary is available (normal CI), the suite runs exactly as before. Verified offline: the suite now skips and `driver-mongodb` test exits 0 (2 files passed | 1 skipped; 38 passed | 37 skipped). https://claude.ai/code/session_01Tv6F1Ub6bhCedrx3r8sZM4
|
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
The monorepo
Test Corejob runspnpm turbo run test, which includes@objectstack/driver-mongodb. That package'smongodb-driver.test.tsusesmongodb-memory-server, which downloads a real MongoDB binary fromfastdl.mongodb.orgon first use. When that download is blocked (sandboxed / offline CI runners, transient network), the suite fails hard — turningTest Corered on unrelated PRs and forcing empty-commit re-triggers (seen on #1436 and #1440).Fix
Attempt to start the in-memory server once at collection time and
describe.skipIfthe suite when startup fails, so it skips cleanly instead of failing. A throwingbeforeAllwould fail every test rather than skip it, which is why the startup moves to a top-level guard. When the binary is available (normal CI), the suite runs exactly as before.Test-only change; no runtime/published code is touched.
Verification (offline sandbox, where the binary can't download)
driver-mongodbtest now exits 0 (previously: hard failure on the download error).https://claude.ai/code/session_01Tv6F1Ub6bhCedrx3r8sZM4
Generated by Claude Code