Skip to content

Commit

Permalink
change terminology up upstream-diff-to-release (GoogleCloudPlatform#5085
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ScottSuarez authored and khajduczenia committed Oct 12, 2021
1 parent a2292af commit 0a1c0a0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions mmv1/third_party/terraform/utils/provider_test.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,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 @@ -957,25 +957,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 @@ -993,7 +993,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

0 comments on commit 0a1c0a0

Please sign in to comment.