TritonDataCenter / terraform-provider-triton

Terraform Joyent Triton provider
https://www.terraform.io/docs/providers/triton/
Mozilla Public License 2.0
15 stars 24 forks source link

Introduce retryOnError for retrying calls to Triton #37

Closed jwreagor closed 7 years ago

jwreagor commented 7 years ago

My hope was to address some of the timing issues around deletions. The goal is to retry given a known error and continue to attempt provisioning until that error is gone. This has helped some of the known issues I've experienced in practice but has not fixed the issue under acceptance testing.

Sharing this for open feedback w/ @jen20 @stack72

jwreagor commented 7 years ago

It does appear as if this assists the situation when you add a new nic by updating a triton_machine.networks array. I was only wrapping RemoveNIC and not AddNIC as well. I'll update this PR along with a dependent bug fix under triton-go.

jwreagor commented 7 years ago

That is to say, this will fix...

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccTritonMachine_addNIC -timeout 120m
?       github.com/terraform-providers/terraform-provider-triton        [no test files]
=== RUN   TestAccTritonMachine_addNIC
--- FAIL: TestAccTritonMachine_addNIC (269.52s)
        testing.go:434: Step 2 error: Error applying: 1 error(s) occurred:

                * triton_machine.test: 1 error(s) occurred:

                * triton_machine.test: ResourceFound: /hashicorp/machines/d999afcc-4c16-6e8f-dff0-8e341d146355/nics/90b8d092a9b5
FAIL
FAIL    github.com/terraform-providers/terraform-provider-triton/triton 269.541s
make: *** [testacc] Error 1

...into...

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccTritonMachine_addNIC -timeout 120m
?       github.com/terraform-providers/terraform-provider-triton        [no test files]
=== RUN   TestAccTritonMachine_addNIC
--- PASS: TestAccTritonMachine_addNIC (374.55s)
PASS
ok      github.com/terraform-providers/terraform-provider-triton/triton 374.573s

Notice the extended time difference which is the new retry function.

stack72 commented 7 years ago

Yay! This is much more solid - awesome work here @cheapRoc :)

LGTM!