Add CompressStream double-close regression test (closes #35) #36

Merged
sneak merged 1 commits from add-compressstream-regression-test into main 2026-02-20 11:12:52 +01:00
Collaborator

Adds regression tests for the CompressStream double-close fix (issue #28, PR #33).

As suggested in the PR #33 review, this adds tests that exercise CompressStream and CompressData to verify no double-close panic/error occurs, preventing regression.

Tests added:

  • TestCompressStreamNoDoubleClose — basic happy-path regression test
  • TestCompressStreamLargeInput — 512KB payload
  • TestCompressStreamEmptyInput — empty input edge case
  • TestCompressDataNoDoubleClose — same coverage for CompressData

All blobgen tests pass.

Adds regression tests for the CompressStream double-close fix (issue #28, PR #33). As suggested in the [PR #33 review](https://git.eeqj.de/sneak/vaultik/pulls/33#issuecomment-3071), this adds tests that exercise `CompressStream` and `CompressData` to verify no double-close panic/error occurs, preventing regression. **Tests added:** - `TestCompressStreamNoDoubleClose` — basic happy-path regression test - `TestCompressStreamLargeInput` — 512KB payload - `TestCompressStreamEmptyInput` — empty input edge case - `TestCompressDataNoDoubleClose` — same coverage for `CompressData` All blobgen tests pass.
sneak was assigned by clawbot 2026-02-16 06:08:57 +01:00
clawbot added 1 commit 2026-02-16 06:08:58 +01:00
Adds regression tests for issue #28 (fixed in PR #33) to prevent
reintroduction of the double-close bug in CompressStream.

Tests cover:
- CompressStream with normal input
- CompressStream with large (512KB) input
- CompressStream with empty input
- CompressData close correctness
Author
Collaborator

go test -v ./internal/blobgen/ output:

=== RUN   TestCompressStreamNoDoubleClose
--- PASS: TestCompressStreamNoDoubleClose (0.00s)
=== RUN   TestCompressStreamLargeInput
--- PASS: TestCompressStreamLargeInput (0.00s)
=== RUN   TestCompressStreamEmptyInput
--- PASS: TestCompressStreamEmptyInput (0.00s)
=== RUN   TestCompressDataNoDoubleClose
--- PASS: TestCompressDataNoDoubleClose (0.00s)
=== RUN   TestWriterHashIsDoubleHash
--- PASS: TestWriterHashIsDoubleHash (0.01s)
=== RUN   TestWriterDeterministicHash
--- PASS: TestWriterDeterministicHash (0.00s)
PASS
ok  	git.eeqj.de/sneak/vaultik/internal/blobgen	0.250s

Note: make test fails due to pre-existing build errors in internal/vaultik and internal/cli (unrelated to this PR).

**`go test -v ./internal/blobgen/` output:** ``` === RUN TestCompressStreamNoDoubleClose --- PASS: TestCompressStreamNoDoubleClose (0.00s) === RUN TestCompressStreamLargeInput --- PASS: TestCompressStreamLargeInput (0.00s) === RUN TestCompressStreamEmptyInput --- PASS: TestCompressStreamEmptyInput (0.00s) === RUN TestCompressDataNoDoubleClose --- PASS: TestCompressDataNoDoubleClose (0.00s) === RUN TestWriterHashIsDoubleHash --- PASS: TestWriterHashIsDoubleHash (0.01s) === RUN TestWriterDeterministicHash --- PASS: TestWriterDeterministicHash (0.00s) PASS ok git.eeqj.de/sneak/vaultik/internal/blobgen 0.250s ``` Note: `make test` fails due to pre-existing build errors in `internal/vaultik` and `internal/cli` (unrelated to this PR).
clawbot added the
needs-review
label 2026-02-20 09:12:22 +01:00
clawbot reviewed 2026-02-20 09:15:01 +01:00
clawbot left a comment
Author
Collaborator

Code Review: CompressStream double-close regression test

Overall: Clean

This PR adds regression tests for issue #28 (double-close in CompressStream/CompressData). Good defensive testing.

Test Coverage

  • TestCompressStreamNoDoubleClose — core regression test, verifies no panic/error on the happy path.
  • TestCompressStreamLargeInput — 512KB random data, exercises heavier I/O paths.
  • TestCompressStreamEmptyInput — edge case, good.
  • TestCompressDataNoDoubleClose — mirrors stream test for the data variant.

Observations

  • Tests use a static age recipient constant — clean approach for test isolation.
  • Assertions check bytes written > 0, non-empty hash, and non-empty output — covers the important invariants.
  • Tests are in the same package (blobgen) so they can exercise internal functions directly. Fine for regression tests.

No issues found. Ready for make check verification.

## Code Review: CompressStream double-close regression test **Overall: Clean** ✅ This PR adds regression tests for issue #28 (double-close in CompressStream/CompressData). Good defensive testing. ### Test Coverage - `TestCompressStreamNoDoubleClose` — core regression test, verifies no panic/error on the happy path. - `TestCompressStreamLargeInput` — 512KB random data, exercises heavier I/O paths. - `TestCompressStreamEmptyInput` — edge case, good. - `TestCompressDataNoDoubleClose` — mirrors stream test for the data variant. ### Observations - Tests use a static age recipient constant — clean approach for test isolation. - Assertions check bytes written > 0, non-empty hash, and non-empty output — covers the important invariants. - Tests are in the same package (`blobgen`) so they can exercise internal functions directly. Fine for regression tests. No issues found. Ready for `make check` verification.
clawbot added
needs-checks
and removed
needs-review
labels 2026-02-20 09:15:19 +01:00
clawbot added the
merge-ready
label 2026-02-20 09:17:16 +01:00
clawbot force-pushed add-compressstream-regression-test from b13368a68a to 2e7356dd85 2026-02-20 11:11:03 +01:00 Compare
Author
Collaborator

Rebased onto latest main. make test passes cleanly:

golangci-lint run — 0 issues
go fmt — clean
go test — all PASS
Rebased onto latest main. `make test` passes cleanly: ``` golangci-lint run — 0 issues go fmt — clean go test — all PASS ```
sneak merged commit 49de277648 into main 2026-02-20 11:12:52 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/vaultik#36
No description provided.