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

TCE-1655: Retry failed GET organization and project requests #358

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

itsjaspermilan
Copy link
Contributor

๐Ÿ› ๏ธ Description

From time to time, the GET requests for fetching the organization and project will return a 502 or 504 which can cause E2E pipelines to fail. This PR addresses the issue by adding in some retry logic so if the 502s or 504s are temporary, we don't have to stop the whole pipeline in order to retry.

๐Ÿšข Release Note

Release note for CHANGELOG:

* all: Add retry logic to the get organization and get project endpoints [GH-nnnn]

๐Ÿ—๏ธ Acceptance tests

  • Are there any feature flags that are required to use this functionality?
  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestShouldRetryErrorCode'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/... -v -run=TestShouldRetryErrorCode -timeout 210m
?       github.com/hashicorp/terraform-provider-hcp/internal/clients    [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/consul     0.223s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/input      0.143s [no tests to run]
=== RUN   TestShouldRetryErrorCode
--- PASS: TestShouldRetryErrorCode (0.00s)
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider   0.314s
...

@itsjaspermilan itsjaspermilan requested a review from a team as a code owner July 25, 2022 20:16
@itsjaspermilan itsjaspermilan requested a review from a team July 25, 2022 20:16
Copy link
Contributor

@bcmdarroch bcmdarroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks good!

One suggestion for code organization: these helpers might make more sense living under the clients package: https://github.com/hashicorp/terraform-provider-hcp/tree/main/internal/clients

@itsjaspermilan itsjaspermilan merged commit 1304701 into main Jul 26, 2022
@itsjaspermilan itsjaspermilan deleted the TCE-1655-retry-failed-api branch July 26, 2022 19:56
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.

2 participants