Skip to content

chore: migrate to hashicorp/terraform-plugin-testing #1616

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tenthirtyam
Copy link
Contributor

Description

Migrate a provider's acceptance tests from the legacy SDKv2 to the testing module, github.com/hashicorp/terraform-plugin-testing:

  • github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest >>> github.com/hashicorp/terraform-plugin-testing/helper/acctest
  • github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource >>> github.com/hashicorp/terraform-plugin-testing/helper/resource
  • github.com/hashicorp/terraform-plugin-sdk/v2/terraform >>> github.com/hashicorp/terraform-plugin-testing/terraform

Reference

Migrating from SDK

@tenthirtyam tenthirtyam added the chore Chore label Apr 22, 2025
@tenthirtyam tenthirtyam requested a review from annakhm April 22, 2025 02:11
@tenthirtyam tenthirtyam self-assigned this Apr 22, 2025
@tenthirtyam tenthirtyam marked this pull request as draft April 22, 2025 10:37
@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch from b46b87c to a09d5f7 Compare April 22, 2025 10:38
@tenthirtyam
Copy link
Contributor Author

Will mark as Ready for Review once I address a failure in the linting.

@tenthirtyam tenthirtyam added the technical-debt Technical Debt label Apr 22, 2025
@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch 2 times, most recently from 4ab1469 to 554dd9d Compare April 22, 2025 12:07
@tenthirtyam tenthirtyam marked this pull request as ready for review April 22, 2025 12:07
@annakhm
Copy link
Contributor

annakhm commented Apr 22, 2025

/test-all

@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch from 554dd9d to ff1e31e Compare April 23, 2025 01:44
@ksamoray
Copy link
Contributor

/test-all

@ksamoray
Copy link
Contributor

Basically this seem to work, so LGTM. @annakhm any reservations about merging this?

@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch 2 times, most recently from cdf6b72 to 64c0323 Compare April 30, 2025 15:57
@ksamoray
Copy link
Contributor

ksamoray commented May 4, 2025

/test-all

@ksamoray
Copy link
Contributor

ksamoray commented May 4, 2025

Seems like something broke here: tests are failing with:

/tmp/go-build3325382039/b001/nsxt.test flag redefined: sweep
panic: /tmp/go-build3325382039/b001/nsxt.test flag redefined: sweep

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc0000f2000, {0x2d0acc8, 0xc000236e70}, {0x28f2b8c, 0x5}, {0x294950b, 0x29})
	/home/ubuntu/go/pkg/mod/golang.org/[email protected]/src/flag/flag.go:1028 +0x37d
flag.(*FlagSet).StringVar(...)
	/home/ubuntu/go/pkg/mod/golang.org/[email protected]/src/flag/flag.go:879
flag.(*FlagSet).String(0xc0000f2000, {0x28f2b8c, 0x5}, {0x0, 0x0}, {0x294950b, 0x29})
	/home/ubuntu/go/pkg/mod/golang.org/[email protected]/src/flag/flag.go:892 +0xa5
flag.String(...)
	/home/ubuntu/go/pkg/mod/golang.org/[email protected]/src/flag/flag.go:899
github.com/hashicorp/terraform-plugin-testing/helper/resource.init()
	/home/ubuntu/go/pkg/mod/github.com/hashicorp/[email protected]/helper/resource/testing.go:56 +0x3b
exit status 2
FAIL	github.com/vmware/terraform-provider-nsxt/nsxt	0.011s

@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch from 64c0323 to 795655a Compare May 4, 2025 16:14
@tenthirtyam
Copy link
Contributor Author

I've rebased it and will review on May 5th.

@tenthirtyam
Copy link
Contributor Author

/test-all

@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch 2 times, most recently from cea9fc8 to 0c9dfe4 Compare May 5, 2025 13:45
Migrate a provider's acceptance tests from the legacy SDKv2 to the testing module, `github.com/hashicorp/terraform-plugin-testing`:

- `github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest` >>> `github.com/hashicorp/terraform-plugin-testing/helper/acctest`
- `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource` >>> `github.com/hashicorp/terraform-plugin-testing/helper/resource`
- `github.com/hashicorp/terraform-plugin-sdk/v2/terraform` >>> `github.com/hashicorp/terraform-plugin-testing/terraform`

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam force-pushed the chore/migrate-to-terraform-plugin-testing branch from 0c9dfe4 to bdb1cc0 Compare May 5, 2025 13:51
@tenthirtyam
Copy link
Contributor Author

/test-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chore technical-debt Technical Debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants