This pull request is the first of a set of refactories with breaking changes. The objective is mitigate a class of bugs (forexample) where the JSON marshaling fails to distinguish between unset fields and those set to a zero-value. One solution is to use pointers for struct fields. This concept isn't novel, I've taken it from the go-github wrapper.
Additionally, I'm including two other changes:
TestID is now int64. In general, I want to future-proof our IDs to support > 2^32. I'll prepare another pull request modifying the rest of the ID fields.
I'm dropping omitempty for alertRules. Failing to set this field makes ThousandEyes assign default alert rules, which confuses the Terraform state. Better to be explicit and assign alert rules via Terraform.
All tests are passing after these changes:
$ go test
2022/05/20 16:12:46 [INFO] 100 of 240 requests / min remain. Sleeping 750ms to prevent rate limiting.
2022/05/20 16:12:46 [INFO] 100 of 240 requests / min remain. Sleeping 2s to prevent rate limiting.
2022/05/20 16:12:46 [INFO] 100 of 240 requests / min remain. Sleeping 2s to prevent rate limiting.
2022/05/20 16:12:46 [INFO] 100 of 240 requests / min remain. Sleeping 250ms to prevent rate limiting.
2022/05/20 16:12:46 [INFO] Rate Limited: Sleeping 31s before resubmitting
2022/05/20 16:12:46 [INFO] Rate Limited: Sleeping 31s before resubmitting
2022/05/20 16:12:46 [INFO] 240 of 240 requests / min remain. Sleeping 250ms to prevent rate limiting.
2022/05/20 16:12:46 [INFO] Rate Limited: Sleeping 1m0s before resubmitting
PASS
ok github.com/thousandeyes/go-thousandeyes 0.100s
This pull request is the first of a set of refactories with breaking changes. The objective is mitigate a class of bugs (for example) where the JSON marshaling fails to distinguish between unset fields and those set to a zero-value. One solution is to use pointers for struct fields. This concept isn't novel, I've taken it from the go-github wrapper.
Additionally, I'm including two other changes:
TestID
is now int64. In general, I want to future-proof our IDs to support > 2^32. I'll prepare another pull request modifying the rest of the ID fields.omitempty
foralertRules
. Failing to set this field makes ThousandEyes assign default alert rules, which confuses the Terraform state. Better to be explicit and assign alert rules via Terraform.All tests are passing after these changes: