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

Test creation on Consul cluster root token #142

Merged
merged 2 commits into from
Jun 11, 2021

Conversation

lackeyjb
Copy link
Contributor

๐Ÿ› ๏ธ Description

Because the root token has a no-op for reading the resource, we only
create the token to ensure that it does not error upon creation.

๐Ÿ—๏ธ Acceptance tests

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

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccConsulCluster'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/... -v -run=TestAccConsulCluster -timeout 120m
?   	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.190s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/input	0.150s [no tests to run]
=== RUN   TestAccConsulCluster
--- PASS: TestAccConsulCluster (585.82s)
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider	586.387s

Because the root token has a no-op for reading the resource, we only
create the token to ensure that it does not error upon creation.
@lackeyjb lackeyjb requested a review from a team June 10, 2021 14:19
// to shorten testing time.
// This includes tests against both the resource, the corresponding datasource,
// and creation of the Consul cluster root token resource in order to shorten
// testing time.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add some assertions below on the root token output? (accessor_id, secret_id, and kubernetes_secret)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests results after updates:

$ make testacc TESTARGS='-run=TestAccConsulCluster'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/... -v -run=TestAccConsulCluster -timeout 120m
?   	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.692s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/input	1.422s [no tests to run]
=== RUN   TestAccConsulCluster
--- PASS: TestAccConsulCluster (582.54s)
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider	583.039s

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.

๐Ÿ™Œ so glad to get all this test coverage!

@lackeyjb lackeyjb merged commit 93dcef4 into main Jun 11, 2021
@lackeyjb lackeyjb deleted the hcpe-1083-consul-cluster-root-token-test branch June 11, 2021 13:59
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