Skip to content

Commit

Permalink
Order steps correctly, plan only on local test (GoogleCloudPlatform#5144
Browse files Browse the repository at this point in the history
)

* Order steps correctly, plan only on local test

* Always add test step
  • Loading branch information
slevenick authored and khajduczenia committed Oct 12, 2021
1 parent 58caa82 commit 667b2bd
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions mmv1/third_party/terraform/utils/provider_test.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 667b2bd

Please sign in to comment.