Skip to content

Commit

Permalink
Order steps correctly, plan only on local test (#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 Aug 26, 2021
1 parent 4d07dbc commit 4e4b6af
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 4e4b6af

Please sign in to comment.