Skip to content

Commit

Permalink
change terminology up upstream-diff-to-release (#5085) (#9840)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 17, 2021
1 parent 93b5e56 commit 4abf67b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/5085.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
24 changes: 12 additions & 12 deletions google/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ func vcrTest(t *testing.T, c resource.TestCase) {
providers := getTestAccProviders(t.Name())
c.Providers = providers
defer closeRecorder(t)
} else if isUpstreamDiffEnabled() {
c = initializeUpstreamDiffTest(c)
} else if isReleaseDiffEnabled() {
c = initializeReleaseDiffTest(c)
}
resource.Test(t, c)
}
Expand Down Expand Up @@ -940,25 +940,25 @@ func sleepInSecondsForTest(t int) resource.TestCheckFunc {
}
}

func isUpstreamDiffEnabled() bool {
upstreamDiff := os.Getenv("UPSTREAM_DIFF")
return upstreamDiff != ""
func isReleaseDiffEnabled() bool {
releaseDiff := os.Getenv("RELEASE_DIFF")
return releaseDiff != ""
}

func initializeUpstreamDiffTest(c resource.TestCase) resource.TestCase {
var upstreamProvider string
func initializeReleaseDiffTest(c resource.TestCase) resource.TestCase {
var releaseProvider string
packagePath := fmt.Sprint(reflect.TypeOf(Config{}).PkgPath())
if strings.Contains(packagePath, "google-beta") {
upstreamProvider = "google-beta"
releaseProvider = "google-beta"
} else {
upstreamProvider = "google"
releaseProvider = "google"
}

if c.ExternalProviders != nil {
c.ExternalProviders[upstreamProvider] = resource.ExternalProvider{}
c.ExternalProviders[releaseProvider] = resource.ExternalProvider{}
} else {
c.ExternalProviders = map[string]resource.ExternalProvider{
upstreamProvider: {},
releaseProvider: {},
}
}

Expand All @@ -976,7 +976,7 @@ func initializeUpstreamDiffTest(c resource.TestCase) resource.TestCase {
replacementSteps = append(replacementSteps, teststep)
if teststep.ExpectError == nil && teststep.PlanOnly == false {
newStep := resource.TestStep{
Config: reformConfigWithProvider(ogConfig, upstreamProvider),
Config: reformConfigWithProvider(ogConfig, releaseProvider),
PlanOnly: true,
}
replacementSteps = append(replacementSteps, newStep)
Expand Down
2 changes: 1 addition & 1 deletion google/resource_container_node_pool.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package google

import (
"context"
"fmt"
"log"
"regexp"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
Expand Down

0 comments on commit 4abf67b

Please sign in to comment.