Skip to content

test: restore leaked envMngr.get stub in installation.test.js - #1178

Merged
kriszyp merged 2 commits into
mainfrom
kris/fix-installation-test-stub-leak
Jun 9, 2026
Merged

test: restore leaked envMngr.get stub in installation.test.js#1178
kriszyp merged 2 commits into
mainfrom
kris/fix-installation-test-stub-leak

Conversation

@kriszyp

@kriszyp kriszyp commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

unitTests/utility/installation.test.js aliased the entire sinon module as sandbox (const sandbox = require('sinon')), stubbed envMngr.get in before(), but its after() only restored fsStatStub. The get stub 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 with sandbox.restore() in after().

Purpose

The leaked envMngr.get stub silently corrupts config reads in later tests, and broke unitTests/utility/lmdb/OpenDBIObject.test.js in CI with TypeError: 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

  • The change is 4 lines in one test file; no production code is touched, so it can only remove a leaked stub, not change runtime behavior.
  • Reproduction confirmed locally: with the original installation.test.js, running it followed by the pre-immune OpenDBIObject.test.js throws "already wrapped"; with this fix the stub setup succeeds.

Note: the full local unit suite could not be run to completion in this environment (memory pressure + shared global-setup RocksDB lock contention from concurrent test runs), so CI is the authoritative full-suite signal here.

Generated by Claude (Opus).

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>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@kriszyp
kriszyp requested a review from DavidCockerill June 9, 2026 02:11
@claude

claude Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@kriszyp
kriszyp marked this pull request as ready for review June 9, 2026 02:31
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@kriszyp
kriszyp merged commit 5ba2958 into main Jun 9, 2026
42 of 43 checks passed
@kriszyp
kriszyp deleted the kris/fix-installation-test-stub-leak branch June 9, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant