Conversation
AssertHTTPResultShapeWithRetry printed a message and returned false on timeout without ever touching *testing.T. No caller in misc/test reads the returned bool, so an example whose endpoint never came up still reported PASS. Fail via assert.Failf instead, and carry the reason the last attempt failed (transport error, non-200 status, or a body that `ready` rejected) into the message, since "no successful GET" without the reason is not actionable. Add a helper unit test covering all three timeout reasons and the success path. It uses httptest servers with maxWait of 0, so it runs in milliseconds and needs no cloud credentials. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 11, 2026
iwahbe
approved these changes
Sep 14, 2026
iwahbe
left a comment
Member
There was a problem hiding this comment.
If the tests were consistently failing before, you can skip them here. Otherwise we need to wait until they are fixed before merging.
I don't want to make a red CI run meaningless.
Comment on lines
+86
to
+87
| // No caller reads the returned bool, so the test only fails if we fail | ||
| // it here. Returning false alone lets a never-successful check pass. |
Member
There was a problem hiding this comment.
Callers read the returned bool for control flow reasons, just like assert.Equal. As a general rule, Assert* test helpers should fail the *testing.T exactly when they return false.
| @@ -70,9 +80,14 @@ | |||
| // Verify it matches expectations | |||
| return check(bodyText) | |||
Member
There was a problem hiding this comment.
Suggested change
| return check(bodyText) | |
| return assert.True(t, check(bodyText), "check failed") |
| func AssertHTTPResultShapeWithRetry(t *testing.T, output interface{}, headers map[string]string, maxWait time.Duration, | ||
| ready func(string) bool, check func(string) bool) bool { | ||
| hostname, ok := output.(string) | ||
| if !assert.True(t, ok, fmt.Sprintf("expected `%s` output", output)) { |
Member
There was a problem hiding this comment.
While we are here...
Suggested change
| if !assert.Truef(t, ok, "expected `%s` output", output) { |
This branch has not been deployed
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.
misc/test/helpers/http.go's retry loop printed a message and returnedfalseon timeout without ever touching*testing.T. No caller reads that return value, so an example whose endpoint never came up still reported PASS. That is around 46 call sites across the AWS, Google, Kubernetes, DigitalOcean and performance suites.The timeout path now calls
assert.Failfand reports what the last attempt actually hit: a transport error, an unexpected status, or a bodyreadyhad not accepted. Previouslyerrwasnilon any non-200, so the log printedHttp Error: <nil>and dropped the status code.This will turn currently-green tests red, at least
TestAccGcpHclWebserverandTestAccAwsTsApiGateway. They are already failing and reporting success.Added
misc/test/helpers/http_test.go: the three timeout reasons plus the success path, against localhttptestservers. Runs in 0.047s, no credentials.