fix: avoid test timeout in extractZipArchive by batching writes#830
Merged
Conversation
The 'it can extract a larger zip' test wrote 5000+ individual lines via separate async fs operations, which could exceed the 30s test timeout on slow CI runners (observed on Node 24). Build the entire zip content in memory as a single Buffer and write it in one operation instead.
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
Fixes flaky
extractZipArchivetest timeout on Node 24 CI runners.Problem
The
it can extract a larger ziptest insystem.test.tswrote 5000+ individual lines via separateawait zipf.writeFile()calls in a loop. Each call is a separate async I/O operation. On slow CI runners (particularly Node 24), this easily exceeds the 30s default test timeout.Observed failure: https://github.com/getsentry/craft/actions/runs/26979168729
Fix
Build the entire zip content in memory as a single
Buffer(header + 5000 lines + footer) and write it in onefs.promises.writeFile()call. This reduces 5002 async I/O operations to 1, making the test complete in milliseconds rather than tens of seconds.The checksum assertion is unchanged, confirming the generated zip is byte-identical.