-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: acceptance test #153
Conversation
5722b8d
to
1eeadbb
Compare
1eeadbb
to
4072584
Compare
bcbedf7
to
55f9ac0
Compare
@@ -1,69 +1,76 @@ | |||
module github.com/thousandeyes/terraform-provider-thousandeyes | |||
|
|||
go 1.17 | |||
go 1.20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to upgrade due to some testing logic that needs go 1.20
|
||
func New(version string) func() *schema.Provider { | ||
func New() func() *schema.Provider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
@@ -70,11 +72,11 @@ func Provider() *schema.Provider { | |||
"thousandeyes_bgp_monitor": dataSourceThousandeyesBGPMonitor(), | |||
"thousandeyes_integration": dataSourceThousandeyesIntegration(), | |||
}, | |||
ConfigureFunc: providerConfigure, | |||
ConfigureContextFunc: providerConfigureWithContext, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taking care of some Deprecation warning
return testAccCheckResourceDestroy(resourceList, state) | ||
}, | ||
checkFunc: []resource.TestCheckFunc{ | ||
resource.TestCheckResourceAttr(ftpResourceName, "alerts_enabled", "true"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only scratched the surface here, we can do way more complex validations: https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests/teststep
For bootstrapping the acceptance tests, this is enough since each tests the following flow:
1- Terraform Plan
2- Terraform Apply
3- New terraform plan to make sure that there are no reported changes
4- Terraform destroy
5- Check, using our testAccCheckDefaultResourceDestroy
method that the resources were actually destroyed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks guys!!
3003b3b
3003b3b
to
87aad1f
Compare
@@ -24,7 +24,7 @@ func main() { | |||
opts := &plugin.ServeOpts{ | |||
Debug: debugMode, | |||
ProviderAddr: "registry.terraform.io/thousandeyes/thousandeyes", | |||
ProviderFunc: thousandeyes.New(version), | |||
ProviderFunc: thousandeyes.New(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the global var version
still needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed it, thanks!
Don't think so. But upon looking at the comment, it seems that goreleaser did something with the version... not sure how though, since the Provider didn't use the variable 🤔
This adds acceptance tests and runs against
API Team TF Providers
account in STG US.For that effect, its reading the aid and token from some Repository Secrets within the and since this is a public repo, there's a limitation where Pull Request coming from forks are unable to read said secrets. Because of that, we need to create a branch within the repo instead of on ours forks.