Skip to content

fix: avoid test timeout in extractZipArchive by batching writes#830

Merged
BYK merged 2 commits into
masterfrom
fix/flaky-zip-test
Jun 4, 2026
Merged

fix: avoid test timeout in extractZipArchive by batching writes#830
BYK merged 2 commits into
masterfrom
fix/flaky-zip-test

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Jun 4, 2026

Summary

Fixes flaky extractZipArchive test timeout on Node 24 CI runners.

Problem

The it can extract a larger zip test in system.test.ts wrote 5000+ individual lines via separate await 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 one fs.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.

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.
@BYK BYK merged commit e6ef5dc into master Jun 4, 2026
21 checks passed
@BYK BYK deleted the fix/flaky-zip-test branch June 4, 2026 22:02
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