chore: maybe improved integration test for additional headers?#1773
Merged
mterhar merged 4 commits intomterhar.additional-headersfrom Jan 14, 2026
Merged
chore: maybe improved integration test for additional headers?#1773mterhar merged 4 commits intomterhar.additional-headersfrom
mterhar merged 4 commits intomterhar.additional-headersfrom
Conversation
Mostly this is about moving the assertions about the presence and value of expected headers into the test HTTP server's response handler. Doing so avoids locks (though the locks weren't really hurting anything). Use t.Cleanup() instead of defer to start normalizing that pattern for the day when stop/cleanup functions might care about nested tests running in parallel.
But let's hide our lock shame by hiding the lock behind using a type from the atomic package.
Since locks have come back but hidden in atomic types, bring back capturing the headers in the request handler and verifying them at the end of the test in accordance with the usual setup->act->verify pattern.
codeboten
approved these changes
Jan 14, 2026
mterhar
pushed a commit
that referenced
this pull request
Feb 6, 2026
## Which problem is this PR solving? I was playing with the tests to get to know the changes in #1771. The result is mostly the same, but I propose we maintain this version. ## Short description of the changes The multiple commits show my fiddling, but the major changes are: * a single table-driven test * the lock for synchronizing the captured headers is hidden by using an atomic type
mterhar
pushed a commit
that referenced
this pull request
Feb 12, 2026
## Which problem is this PR solving? I was playing with the tests to get to know the changes in #1771. The result is mostly the same, but I propose we maintain this version. ## Short description of the changes The multiple commits show my fiddling, but the major changes are: * a single table-driven test * the lock for synchronizing the captured headers is hidden by using an atomic type
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.
Which problem is this PR solving?
I was playing with the tests to get to know the changes in #1771. The result is mostly the same, but I propose we maintain this version.
Short description of the changes
The multiple commits show my fiddling, but the major changes are: