Skip to content

Commit

Permalink
Removing checking whether TestStep.Config contains provider block to …
Browse files Browse the repository at this point in the history
…reinstate prior behaviour (#176)
  • Loading branch information
bendbennett committed Aug 31, 2023
1 parent 5b9c7a4 commit a771346
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 0 additions & 1 deletion helper/resource/teststep_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (s TestStep) hasProviders(ctx context.Context, stepIndex int, testName stri
configRequest := teststep.PrepareConfigurationRequest{
Directory: s.ConfigDirectory,
File: s.ConfigFile,
Raw: s.Config,
TestStepConfigRequest: config.TestStepConfigRequest{
StepNumber: stepIndex + 1,
TestName: testName,
Expand Down
13 changes: 13 additions & 0 deletions helper/resource/teststep_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ func TestTestStepValidate(t *testing.T) {
},
expectedError: fmt.Errorf("TestStep ImportState must be specified with ImportStateId, ImportStateIdFunc, or ResourceName"),
},
// This test has been added to verify that providers can be defined
// both within the TestStep.Config and at the TestCase level.
// The regression was reported in
// https://github.com/hashicorp/terraform-plugin-testing/issues/176
"config-providers-testcase-providers": {
testStep: TestStep{
Config: "provider abc {",
},
testStepConfig: "# not empty",
testStepValidateRequest: testStepValidateRequest{
TestCaseHasProviders: true,
},
},
"protov5providerfactories-testcase-providers": {
testStep: TestStep{
ProtoV5ProviderFactories: map[string]func() (tfprotov5.ProviderServer, error){
Expand Down

0 comments on commit a771346

Please sign in to comment.