test: restore leaked envMngr.get stub in installation.test.js - #1178
Merged
Conversation
This test aliased the whole sinon module as `sandbox` and stubbed
envMngr.get in before(), but after() only restored fsStatStub — leaking
the get stub into later unit-test files. That broke OpenDBIObject.test.js
in CI ("Attempted to wrap get which is already wrapped") and could silently
corrupt config reads in any test running afterward. Use an isolated
sinon.createSandbox() and restore it in after() so every stub is torn down.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Contributor
|
Reviewed; no blockers found. |
kriszyp
marked this pull request as ready for review
June 9, 2026 02:31
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
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.
Summary
unitTests/utility/installation.test.jsaliased the entiresinonmodule assandbox(const sandbox = require('sinon')), stubbedenvMngr.getinbefore(), but itsafter()only restoredfsStatStub. Thegetstub therefore leaked into every test file that ran afterward in the full unit suite.The fix switches the test to an isolated
sinon.createSandbox()and tears everything down withsandbox.restore()inafter().Purpose
The leaked
envMngr.getstub silently corrupts config reads in later tests, and brokeunitTests/utility/lmdb/OpenDBIObject.test.jsin CI withTypeError: Attempted to wrap get which is already wrapped(seen on #1152). OpenDBIObject was made defensively immune to the leak (23a0c83), but the leaking test itself needed fixing for proper isolation.Where to look / verify
installation.test.js, running it followed by the pre-immuneOpenDBIObject.test.jsthrows "already wrapped"; with this fix the stub setup succeeds.Generated by Claude (Opus).