Repository navigation
test: reorganize and table-drive the tests - #82
Merged
Merged
Conversation
Near-identical tests are folded into tables around shared helpers (142 tests, 3,530 lines -> 49 tests, 1,975 lines). A fault-injecting transport in front of fake-gcs-server now covers the generation-changed retry, GCS errors on lookups and reads, and the slow-header timeout (readHeaderTimeout becomes a var so the test can shorten it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The tests inject malformed GCS error JSON, no longer verify generation pinning, and omit the Content-Length absence check after failed reads, leaving important regressions undetected.
3 open issues
What changed in this PR
This PR consolidates gcsproxy’s tests into shared helpers and table-driven cases, while expanding coverage of storage failures and HTTP timeouts.
Changes:
- Reorganizes routing, headers, ranges, conditional requests, and logging tests.
- Adds fault injection for GCS lookup/read errors and generation-change retries.
- Makes the header timeout adjustable for a slow-header test, retaining the 10-second default.
| File | Description |
|---|---|
main.go |
Changes the header timeout from a constant to a variable for testing. |
main_test.go |
Consolidates tests and adds fault-injection and timeout coverage. |
Review effort: Balanced
Inject GCS errors with a numeric code, assert Content-Length is absent after a failed read, and check that reads ask for the validated generation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The revised tests leave retry metadata and precondition re-evaluation unverified and drop error-header, range-validator, and response-body assertions, allowing regressions to pass.
No open issues 🎉
3 resolved since last review
Review effort: Balanced
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.

🤖 Generated with Claude Code