Skip to content

Commit

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

* Always add test step

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 26, 2021
1 parent 84a5746 commit 2154b77
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/5144.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
19 changes: 10 additions & 9 deletions google/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_composer_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 2154b77

Please sign in to comment.