From 2154b77218da257a1b816f7cc05d0af7f43ea82d Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 26 Aug 2021 13:51:02 -0500 Subject: [PATCH] Order steps correctly, plan only on local test (#5144) (#9922) * Order steps correctly, plan only on local test * Always add test step Signed-off-by: Modular Magician --- .changelog/5144.txt | 3 +++ google/provider_test.go | 19 ++++++++++--------- google/resource_composer_environment.go | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 .changelog/5144.txt diff --git a/.changelog/5144.txt b/.changelog/5144.txt new file mode 100644 index 00000000000..8ec013c0699 --- /dev/null +++ b/.changelog/5144.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google/provider_test.go b/google/provider_test.go index cb3fb143673..8db95c07e91 100644 --- a/google/provider_test.go +++ b/google/provider_test.go @@ -969,20 +969,21 @@ func initializeReleaseDiffTest(c resource.TestCase) resource.TestCase { c.Providers = localProvider var replacementSteps []resource.TestStep - for _, teststep := range c.Steps { - if teststep.Config != "" { - ogConfig := teststep.Config - teststep.Config = reformConfigWithProvider(ogConfig, localProviderName) - replacementSteps = append(replacementSteps, teststep) - if teststep.ExpectError == nil && teststep.PlanOnly == false { + for _, testStep := range c.Steps { + if testStep.Config != "" { + ogConfig := testStep.Config + testStep.Config = reformConfigWithProvider(ogConfig, localProviderName) + if testStep.ExpectError == nil && testStep.PlanOnly == false { newStep := resource.TestStep{ - Config: reformConfigWithProvider(ogConfig, releaseProvider), - PlanOnly: true, + Config: reformConfigWithProvider(ogConfig, releaseProvider), } + testStep.PlanOnly = true + testStep.ExpectNonEmptyPlan = false replacementSteps = append(replacementSteps, newStep) } + replacementSteps = append(replacementSteps, testStep) } else { - replacementSteps = append(replacementSteps, teststep) + replacementSteps = append(replacementSteps, testStep) } } diff --git a/google/resource_composer_environment.go b/google/resource_composer_environment.go index fcee2760325..7a9d37a9e3a 100644 --- a/google/resource_composer_environment.go +++ b/google/resource_composer_environment.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "google.golang.org/api/composer/v1beta1" + composer "google.golang.org/api/composer/v1beta1" ) const (