Conversation
| }, | ||
| } | ||
| for _, tc := range tests { | ||
| t.Run(tc.name, func(t *testing.T) { |
There was a problem hiding this comment.
Can we avoid variable name hiding here, and say, use tt? I was surprised seeing the proxyHandler.Reset passed to the cleanup function and was wondering how the hell we expect to get back to between loop iterations.
There was a problem hiding this comment.
Are you referring to t? Shadowing t in subtests is quite common and is actually the preferred approach.
If you have tt and t in scope, it's possible to mistakenly use the wrong one and (for example) fail the top-level test instead of the subtest. Shadowing t makes that impossible because the outer t is no longer accessible to the closure.
It's even written this way in the official docs for the testing package: https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
d3db604 to
5b0b8ea
Compare
65cd42e to
9aea0cb
Compare
This change rewrites a few HTTP_PROXY tests to be less flaky.
9aea0cb to
dd3e3f4
Compare
This change rewrites a few HTTP_PROXY tests to be less flaky.
This change rewrites a few HTTP_PROXY tests to be less flaky.
This change rewrites a few HTTP_PROXY related tests to be less flaky.
Resolves #33197.