From 4e4b6af37240e77a31a61a6f47dde7296beecf52 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Thu, 26 Aug 2021 11:41:06 -0700 Subject: [PATCH] Order steps correctly, plan only on local test (#5144) * Order steps correctly, plan only on local test * Always add test step --- .../terraform/utils/provider_test.go.erb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mmv1/third_party/terraform/utils/provider_test.go.erb b/mmv1/third_party/terraform/utils/provider_test.go.erb index f89e8ba470d0..38e0094fe3d0 100644 --- a/mmv1/third_party/terraform/utils/provider_test.go.erb +++ b/mmv1/third_party/terraform/utils/provider_test.go.erb @@ -986,20 +986,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) } }