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

Providers must only be specified either at the TestCase or TestStep level #176

Closed
mschuchard opened this issue Aug 31, 2023 · 5 comments · Fixed by #177
Closed

Providers must only be specified either at the TestCase or TestStep level #176

mschuchard opened this issue Aug 31, 2023 · 5 comments · Fixed by #177
Labels
bug Something isn't working
Milestone

Comments

@mschuchard
Copy link

mschuchard commented Aug 31, 2023

terraform-plugin-testing version

1.5.0

Relevant provider source code

resource.ParallelTest(test, resource.TestCase{
		PreCheck:                 func() { provider.AccPreCheck(test) },
		ProtoV6ProviderFactories: provider.AccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config: provider.ProviderConfig + fmt.Sprintf(datasourceConfig, foo),
				Check: resource.ComposeAggregateTestCheckFunc(
                                ...
				),
			},
		},
	})

Terraform Configuration Files

n/a

Expected Behavior

The acceptance test case should invoke and execute as expected which is what occurs in version 1.4.0. I have checked the CHANGELOG for 1.5.0 and see nothing about this backwards-incompatible change.

If this issue derives from documentation and not code, then please update CHANGELOG etc. for the change, and clarify the error message in the code as the provider is being specified at the TestCase level according to the above code.

Actual Behavior

Test validation error: TestStep 1/1 validation error: Providers must only be specified either at the TestCase or TestStep level

Steps to Reproduce

TF_ACC=1 go test -v ./<provider>/...

References

not according to search

@mschuchard mschuchard added the bug Something isn't working label Aug 31, 2023
@bflad bflad added this to the v1.5.1 milestone Aug 31, 2023
@bflad
Copy link
Contributor

bflad commented Aug 31, 2023

Hi @mschuchard 👋 Thank you for raising this issue and apologies for this regression. It certainly was not intended and I'm guessing there was not an existing unit test to cover this valid behavior. The team is investigating and will release a patch update to reinstate the prior behavior per our versioning and compatibility promises.

@mschuchard
Copy link
Author

mschuchard commented Aug 31, 2023

Thanks; I have downgraded to 1.4.0 in the interim as that still enables PlanCheck.ExpectUnknownValue() which is the most recent feature I am currently utilizing, so no rush.

bendbennett added a commit that referenced this issue Aug 31, 2023
bendbennett added a commit that referenced this issue Aug 31, 2023
bendbennett added a commit that referenced this issue Aug 31, 2023
… providers defined within `TestStep.Config` (#177)

* Removing checking whether TestStep.Config contains provider block to reinstate prior behaviour (#176)

* Adding changelog (#176)
@bendbennett
Copy link
Contributor

@mschuchard I believe the regression you reported should be resolved in v1.5.1. Please let us know by opening an issue if you encounter any other problems. Thanks for raising the issue.

@mschuchard
Copy link
Author

This also helps me with understanding root cause, and why another of my plugins does not have this issue. The other provider can be completely configured with env, but this one cannot (ergo why AT004 is flagged during linting). Therefore I must also include a stub in Config.
Thanks!

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

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 Oct 1, 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