Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix AssertHTTP retry and improved CFT practices #1749

Merged

Conversation

grayside
Copy link
Contributor

@grayside grayside commented Aug 5, 2023

Fixes #1726

This is a broader change than originally intended, as expanded test coverage surfaced new bugs and that process repeated a couple times.

  1. Retries are now configurable using the new WithHTTPRequestRetries
  2. API know longer uses t.Fatal, instead it uses t.Error for better alignment with testify assert semantics.
  3. Logging now uses GetLoggerFromT for more consistent output with other library functions
  4. If response body is part of the assert, they will be checked even if the status code doesn't match.
  5. Logic is simplified via wrapped errors
  6. httpRetryCondition now returned two booleans: first indicates response success, second that retry is called for.
  7. Test coverage is significantly expanded and uses a table testing approach to improve readability and facilitate consistently testing logic with and without retries

@apeabody
Copy link
Collaborator

apeabody commented Aug 7, 2023

/gcbrun

@bharathkkb bharathkkb merged commit 5e0a077 into GoogleCloudPlatform:master Aug 8, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AssertHTTP: WithRetry methods fail tests on first failed attempt
3 participants