Skip to content

chore: maybe improved integration test for additional headers?#1773

Merged
mterhar merged 4 commits intomterhar.additional-headersfrom
robb.is-this-better-question-mark
Jan 14, 2026
Merged

chore: maybe improved integration test for additional headers?#1773
mterhar merged 4 commits intomterhar.additional-headersfrom
robb.is-this-better-question-mark

Conversation

@robbkidd
Copy link
Member

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

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.
@robbkidd robbkidd requested a review from mterhar January 14, 2026 18:54
@robbkidd robbkidd self-assigned this Jan 14, 2026
@robbkidd robbkidd requested a review from a team as a code owner January 14, 2026 18:54
@robbkidd robbkidd added type: maintenance The necessary chores to keep the dust off. no-changelog Omit this PR from changelog/release notes. labels Jan 14, 2026
@mterhar mterhar merged commit 2d6117e into mterhar.additional-headers Jan 14, 2026
4 checks passed
@mterhar mterhar deleted the robb.is-this-better-question-mark branch January 14, 2026 19:12
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Omit this PR from changelog/release notes. type: maintenance The necessary chores to keep the dust off.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants