fix(test): mock IsolatedContainerVolume in naabu tests to prevent flaky timeouts#295
Merged
fix(test): mock IsolatedContainerVolume in naabu tests to prevent flaky timeouts#295
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 110b912642
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ky timeouts The naabu tests were flaky because component.execute() triggers real Docker commands via IsolatedContainerVolume (volume create, alpine container for file writes/chmod, volume rm) even when runComponentWithRunner is mocked. When Docker is cold or slow, these operations exceed the test timeout. This follows the same pattern already used in dnsx.test.ts and opencode.test.ts. Signed-off-by: Aseem Shrey <LuD1161@users.noreply.github.com>
110b912 to
2c56a9f
Compare
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
Root Cause
component.execute()triggers real Docker commands viaIsolatedContainerVolume— even whenrunComponentWithRunneris already mocked:docker volume create— creates an isolated volumedocker run alpine— writestargets.txtinto the volumedocker run alpine—chmod -R 777on the volumedocker volume rm— cleanupWhen Docker is cold or slow, these operations exceed the 5s test timeout, causing flaky failures like:
this test timed out after 5000msContainerError: Failed to initialize isolated volume: Failed to set volume permissions: exit code 143Fix
Added
mock.moduleforIsolatedContainerVolumeinnaabu.test.ts. This follows the same pattern already used in:dnsx.test.ts(line 5)opencode.test.ts(line 9)The naabu test was the only component test missing this mock.
The mock is scoped to the test file (Bun's
mock.modulebehavior), so it does not affect other tests. The full execute logic (argument building, output parsing, analytics result generation) is still exercised — only the Docker I/O layer is skipped.Test plan