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

Migration to terraform-plugin-testing causes panic in existing test suite #1166

Closed
bendbennett opened this issue Mar 9, 2023 · 4 comments · Fixed by #1167
Closed

Migration to terraform-plugin-testing causes panic in existing test suite #1166

bendbennett opened this issue Mar 9, 2023 · 4 comments · Fixed by #1167
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bendbennett
Copy link
Contributor

SDK version

v2.25.0

Relevant provider source code

// n/a

Terraform Configuration Files

// n/a

Expected Behavior

Following migration to using terraform-plugin-testing all passing tests should continue to pass.

Actual Behavior

panic: /var/folders/23/p8tx31c53rd16t1pjt03zndc0000gq/T/go-build764025451/b443/provider_sdk.test flag redefined: sweep

goroutine 1 [running]:
flag.(*FlagSet).Var(0x14000030240, {0x10132b6d8, 0x140002219c0}, {0x10103ad88, 0x5}, {0x10105d47b, 0x29})
        /usr/local/go/src/flag/flag.go:982 +0x2a4
flag.(*FlagSet).StringVar(...)
        /usr/local/go/src/flag/flag.go:847
flag.(*FlagSet).String(0x1400031fb98?, {0x10103ad88, 0x5}, {0x0, 0x0}, {0x10105d47b, 0x29})
        /usr/local/go/src/flag/flag.go:860 +0x98
flag.String(...)
        /usr/local/go/src/flag/flag.go:867
github.com/hashicorp/terraform-plugin-testing/helper/resource.init()
        /Users/bdb/go/pkg/mod/github.com/hashicorp/terraform-plugin-testing@v1.1.0/helper/resource/testing.go:53 +0x44
FAIL    github.com/bendbennett/terraform-provider-playground/internal/provider_sdk      0.437s
FAIL

Steps to Reproduce

  1. Follow migration guide in any Terraform Provider that uses github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource in any "non-test" files (i.e., any files that are not _test.go).
  2. Run tests

References

@bendbennett bendbennett added the bug Something isn't working label Mar 9, 2023
@bendbennett bendbennett added this to the v2.25.1 milestone Mar 9, 2023
bendbennett added a commit that referenced this issue Mar 9, 2023
…eoutError, StateRefreshFunc, StateChangeConf, RetryFunc, RetryContext, Retry, RetryError, RetryableError and NonRetryableError

Equivalent types and functions are now available in the helper/retry package (#1166)
@bflad bflad modified the milestones: v2.25.1, v2.26.0 Mar 15, 2023
bendbennett added a commit that referenced this issue Mar 16, 2023
…st suite (#1167)

* helper/resource: Deprecating NotFoundError, UnexpectedStateError, TimeoutError, StateRefreshFunc, StateChangeConf, RetryFunc, RetryContext, Retry, RetryError, RetryableError and NonRetryableError

Equivalent types and functions are now available in the helper/retry package (#1166)

* Deprecating helper/resource PrefixedUniqueId() and `UniqueId()` (#1167)

* Responding to code review feedback (#1167)

* Expanding aliases to include helper/id

* Expanding contents of changie notes and adding enhancement entries

* Updating documentation to refer to import of helper/retry
@jacobbednarz
Copy link

thanks for this one @bendbennett ✌️ appreciate you getting to the bottom of it.

@jacobbednarz
Copy link

i just got around to running this in our test suite and it looks like we've still got issues.

the test suite is running on master @ 53a4ec4 and i've made the update to use the dedicated helper/retry package instead of helper/resource for retryables.

you can see the failed CI run at https://github.com/cloudflare/terraform-provider-cloudflare/actions/runs/4463622325/jobs/7839014466?pr=2272.

is there anything else i'm missing here? or have we still got the bug present?

@jacobbednarz
Copy link

sorry, you can disregard this 🤦 it looks like there was a bad three way merge that resulted in still using the old packages. removing those made this work as expected 🎉

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
3 participants