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

[TFPROVDEV-27] Avoid Concurrent calls for Service Dependencies creation #724

Conversation

imjaroiswebdev
Copy link
Contributor

@imjaroiswebdev imjaroiswebdev commented Aug 10, 2023

Concurrent calls to API https://api.pagerduty.com/service_dependencies/associate were producing backend error, due to race conditions, so this patch is introducing a update to avoid making parallel calls to this API, even if Terraform determines the creation of those resources could be parallelised.

Error received when facing this issue...

Error: POST API call to https://api.pagerduty.com/service_dependencies/associate failed: 500 Internal Server Error

Test cases introduced...

$ echo "TestAccPagerDutyBusinessServiceDependency TestAccPagerDutyTechnicalServiceDependency" | xargs -n1 -I{} zsh -c 'make testacc TESTARGS="-count=1 -run {}"'

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -count=1 -run TestAccPagerDutyBusinessServiceDependency -timeout 120m
?       github.com/terraform-providers/terraform-provider-pagerduty     [no test files]
=== RUN   TestAccPagerDutyBusinessServiceDependency_Basic
--- PASS: TestAccPagerDutyBusinessServiceDependency_Basic (16.47s)
=== RUN   TestAccPagerDutyBusinessServiceDependency_Parallel # 👈 New test case
--- PASS: TestAccPagerDutyBusinessServiceDependency_Parallel (57.68s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   74.675s
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -count=1 -run TestAccPagerDutyTechnicalServiceDependency -timeout 120m
?       github.com/terraform-providers/terraform-provider-pagerduty     [no test files]
=== RUN   TestAccPagerDutyTechnicalServiceDependency_Basic
--- PASS: TestAccPagerDutyTechnicalServiceDependency_Basic (16.83s)
=== RUN   TestAccPagerDutyTechnicalServiceDependency_Parallel # 👈 New test case
--- PASS: TestAccPagerDutyTechnicalServiceDependency_Parallel (70.04s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   88.073s

@imjaroiswebdev imjaroiswebdev changed the title [TFPROVDEV-27] Avoid Cconcurrent calls for Service Dependencies creation [TFPROVDEV-27] Avoid Concurrent calls for Service Dependencies creation Aug 10, 2023
@imjaroiswebdev imjaroiswebdev marked this pull request as ready for review August 11, 2023 01:06
@imjaroiswebdev imjaroiswebdev force-pushed the TFPROVDEV-27-no-concurrent-calls-for-serv-deps-creation branch from d141ada to 3ad5215 Compare August 11, 2023 01:07
@imjaroiswebdev imjaroiswebdev merged commit 1825e7e into PagerDuty:master Aug 11, 2023
1 check 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.

1 participant