From 74e087dc299243d2bf97ba07b2887338bf2f1a31 Mon Sep 17 00:00:00 2001 From: Chris Arcand Date: Mon, 20 Sep 2021 16:54:41 -0500 Subject: [PATCH] Rename cloud.testBackendDefault -> cloud.testBackendWithName --- internal/cloud/backend_apply_test.go | 60 +++++++++++++------------- internal/cloud/backend_context_test.go | 2 +- internal/cloud/backend_plan_test.go | 58 ++++++++++++------------- internal/cloud/backend_state_test.go | 2 +- internal/cloud/backend_test.go | 18 ++++---- internal/cloud/testing.go | 4 +- 6 files changed, 72 insertions(+), 72 deletions(-) diff --git a/internal/cloud/backend_apply_test.go b/internal/cloud/backend_apply_test.go index 9f464c3f3..1ae00946a 100644 --- a/internal/cloud/backend_apply_test.go +++ b/internal/cloud/backend_apply_test.go @@ -54,7 +54,7 @@ func testOperationApplyWithTimeout(t *testing.T, configDir string, timeout time. } func TestCloud_applyBasic(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -105,7 +105,7 @@ func TestCloud_applyBasic(t *testing.T) { } func TestCloud_applyCanceled(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -216,7 +216,7 @@ func TestCloud_applyWithVCS(t *testing.T) { } func TestCloud_applyWithParallelism(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -246,7 +246,7 @@ func TestCloud_applyWithParallelism(t *testing.T) { } func TestCloud_applyWithPlan(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -276,7 +276,7 @@ func TestCloud_applyWithPlan(t *testing.T) { } func TestCloud_applyWithoutRefresh(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -313,7 +313,7 @@ func TestCloud_applyWithoutRefresh(t *testing.T) { } func TestCloud_applyWithoutRefreshIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -345,7 +345,7 @@ func TestCloud_applyWithoutRefreshIncompatibleAPIVersion(t *testing.T) { } func TestCloud_applyWithRefreshOnly(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -382,7 +382,7 @@ func TestCloud_applyWithRefreshOnly(t *testing.T) { } func TestCloud_applyWithRefreshOnlyIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -414,7 +414,7 @@ func TestCloud_applyWithRefreshOnlyIncompatibleAPIVersion(t *testing.T) { } func TestCloud_applyWithTarget(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -453,7 +453,7 @@ func TestCloud_applyWithTarget(t *testing.T) { } func TestCloud_applyWithTargetIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -489,7 +489,7 @@ func TestCloud_applyWithTargetIncompatibleAPIVersion(t *testing.T) { } func TestCloud_applyWithReplace(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -528,7 +528,7 @@ func TestCloud_applyWithReplace(t *testing.T) { } func TestCloud_applyWithReplaceIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -562,7 +562,7 @@ func TestCloud_applyWithReplaceIncompatibleAPIVersion(t *testing.T) { } func TestCloud_applyWithVariables(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-variables") @@ -589,7 +589,7 @@ func TestCloud_applyWithVariables(t *testing.T) { } func TestCloud_applyNoConfig(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/empty") @@ -624,7 +624,7 @@ func TestCloud_applyNoConfig(t *testing.T) { } func TestCloud_applyNoChanges(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-no-changes") @@ -656,7 +656,7 @@ func TestCloud_applyNoChanges(t *testing.T) { } func TestCloud_applyNoApprove(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -695,7 +695,7 @@ func TestCloud_applyNoApprove(t *testing.T) { } func TestCloud_applyAutoApprove(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -741,7 +741,7 @@ func TestCloud_applyAutoApprove(t *testing.T) { } func TestCloud_applyApprovedExternally(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -815,7 +815,7 @@ func TestCloud_applyApprovedExternally(t *testing.T) { } func TestCloud_applyDiscardedExternally(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -954,7 +954,7 @@ func TestCloud_applyForceLocal(t *testing.T) { } defer os.Unsetenv("TF_FORCE_LOCAL_BACKEND") - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply") @@ -1066,7 +1066,7 @@ func TestCloud_applyWorkspaceWithoutOperations(t *testing.T) { } func TestCloud_applyLockTimeout(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() ctx := context.Background() @@ -1140,7 +1140,7 @@ func TestCloud_applyLockTimeout(t *testing.T) { } func TestCloud_applyDestroy(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-destroy") @@ -1186,7 +1186,7 @@ func TestCloud_applyDestroy(t *testing.T) { } func TestCloud_applyDestroyNoConfig(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() input := testInput(t, map[string]string{ @@ -1221,7 +1221,7 @@ func TestCloud_applyDestroyNoConfig(t *testing.T) { } func TestCloud_applyPolicyPass(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-policy-passed") @@ -1269,7 +1269,7 @@ func TestCloud_applyPolicyPass(t *testing.T) { } func TestCloud_applyPolicyHardFail(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-policy-hard-failed") @@ -1322,7 +1322,7 @@ func TestCloud_applyPolicyHardFail(t *testing.T) { } func TestCloud_applyPolicySoftFail(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-policy-soft-failed") @@ -1372,7 +1372,7 @@ func TestCloud_applyPolicySoftFail(t *testing.T) { } func TestCloud_applyPolicySoftFailAutoApproveSuccess(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-policy-soft-failed") @@ -1423,7 +1423,7 @@ func TestCloud_applyPolicySoftFailAutoApproveSuccess(t *testing.T) { } func TestCloud_applyPolicySoftFailAutoApply(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() // Create a named workspace that auto applies. @@ -1485,7 +1485,7 @@ func TestCloud_applyPolicySoftFailAutoApply(t *testing.T) { } func TestCloud_applyWithRemoteError(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationApply(t, "./testdata/apply-with-error") @@ -1553,7 +1553,7 @@ func TestCloud_applyVersionCheck(t *testing.T) { for name, tc := range testCases { t.Run(name, func(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() // SETUP: Save original local version state and restore afterwards diff --git a/internal/cloud/backend_context_test.go b/internal/cloud/backend_context_test.go index 7a7668a83..e1001ee52 100644 --- a/internal/cloud/backend_context_test.go +++ b/internal/cloud/backend_context_test.go @@ -176,7 +176,7 @@ func TestRemoteContextWithVars(t *testing.T) { t.Run(name, func(t *testing.T) { configDir := "./testdata/empty" - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() _, configLoader, configCleanup := initwd.MustLoadConfigForTests(t, configDir) diff --git a/internal/cloud/backend_plan_test.go b/internal/cloud/backend_plan_test.go index a76841f2b..19221dc90 100644 --- a/internal/cloud/backend_plan_test.go +++ b/internal/cloud/backend_plan_test.go @@ -52,7 +52,7 @@ func testOperationPlanWithTimeout(t *testing.T, configDir string, timeout time.D } func TestCloud_planBasic(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -90,7 +90,7 @@ func TestCloud_planBasic(t *testing.T) { } func TestCloud_planCanceled(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -120,7 +120,7 @@ func TestCloud_planCanceled(t *testing.T) { } func TestCloud_planLongLine(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-long-line") @@ -191,7 +191,7 @@ func TestCloud_planWithoutPermissions(t *testing.T) { } func TestCloud_planWithParallelism(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -221,7 +221,7 @@ func TestCloud_planWithParallelism(t *testing.T) { } func TestCloud_planWithPlan(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -251,7 +251,7 @@ func TestCloud_planWithPlan(t *testing.T) { } func TestCloud_planWithPath(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -281,7 +281,7 @@ func TestCloud_planWithPath(t *testing.T) { } func TestCloud_planWithoutRefresh(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -318,7 +318,7 @@ func TestCloud_planWithoutRefresh(t *testing.T) { } func TestCloud_planWithoutRefreshIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -350,7 +350,7 @@ func TestCloud_planWithoutRefreshIncompatibleAPIVersion(t *testing.T) { } func TestCloud_planWithRefreshOnly(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -387,7 +387,7 @@ func TestCloud_planWithRefreshOnly(t *testing.T) { } func TestCloud_planWithRefreshOnlyIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -419,7 +419,7 @@ func TestCloud_planWithRefreshOnlyIncompatibleAPIVersion(t *testing.T) { } func TestCloud_planWithTarget(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() // When the backend code creates a new run, we'll tweak it so that it @@ -488,7 +488,7 @@ func TestCloud_planWithTarget(t *testing.T) { } func TestCloud_planWithTargetIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -524,7 +524,7 @@ func TestCloud_planWithTargetIncompatibleAPIVersion(t *testing.T) { } func TestCloud_planWithReplace(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -563,7 +563,7 @@ func TestCloud_planWithReplace(t *testing.T) { } func TestCloud_planWithReplaceIncompatibleAPIVersion(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -597,7 +597,7 @@ func TestCloud_planWithReplaceIncompatibleAPIVersion(t *testing.T) { } func TestCloud_planWithVariables(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-variables") @@ -624,7 +624,7 @@ func TestCloud_planWithVariables(t *testing.T) { } func TestCloud_planNoConfig(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/empty") @@ -653,7 +653,7 @@ func TestCloud_planNoConfig(t *testing.T) { } func TestCloud_planNoChanges(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-no-changes") @@ -692,7 +692,7 @@ func TestCloud_planForceLocal(t *testing.T) { } defer os.Unsetenv("TF_FORCE_LOCAL_BACKEND") - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -814,7 +814,7 @@ func TestCloud_planWorkspaceWithoutOperations(t *testing.T) { } func TestCloud_planLockTimeout(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() ctx := context.Background() @@ -885,7 +885,7 @@ func TestCloud_planLockTimeout(t *testing.T) { } func TestCloud_planDestroy(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") @@ -910,7 +910,7 @@ func TestCloud_planDestroy(t *testing.T) { } func TestCloud_planDestroyNoConfig(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/empty") @@ -935,7 +935,7 @@ func TestCloud_planDestroyNoConfig(t *testing.T) { } func TestCloud_planWithWorkingDirectory(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() options := tfe.WorkspaceUpdateOptions{ @@ -980,7 +980,7 @@ func TestCloud_planWithWorkingDirectory(t *testing.T) { } func TestCloud_planWithWorkingDirectoryFromCurrentPath(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() options := tfe.WorkspaceUpdateOptions{ @@ -1036,7 +1036,7 @@ func TestCloud_planWithWorkingDirectoryFromCurrentPath(t *testing.T) { } func TestCloud_planCostEstimation(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-cost-estimation") @@ -1071,7 +1071,7 @@ func TestCloud_planCostEstimation(t *testing.T) { } func TestCloud_planPolicyPass(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-policy-passed") @@ -1106,7 +1106,7 @@ func TestCloud_planPolicyPass(t *testing.T) { } func TestCloud_planPolicyHardFail(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-policy-hard-failed") @@ -1146,7 +1146,7 @@ func TestCloud_planPolicyHardFail(t *testing.T) { } func TestCloud_planPolicySoftFail(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-policy-soft-failed") @@ -1186,7 +1186,7 @@ func TestCloud_planPolicySoftFail(t *testing.T) { } func TestCloud_planWithRemoteError(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan-with-error") @@ -1218,7 +1218,7 @@ func TestCloud_planWithRemoteError(t *testing.T) { } func TestCloud_planOtherError(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() op, configCleanup, done := testOperationPlan(t, "./testdata/plan") diff --git a/internal/cloud/backend_state_test.go b/internal/cloud/backend_state_test.go index e39dd211f..63c970438 100644 --- a/internal/cloud/backend_state_test.go +++ b/internal/cloud/backend_state_test.go @@ -20,7 +20,7 @@ func TestRemoteClient(t *testing.T) { } func TestRemoteClient_stateLock(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() s1, err := b.StateMgr(testBackendSingleWorkspaceName) diff --git a/internal/cloud/backend_test.go b/internal/cloud/backend_test.go index 9f1a5190b..9ac894467 100644 --- a/internal/cloud/backend_test.go +++ b/internal/cloud/backend_test.go @@ -25,7 +25,7 @@ func TestCloud(t *testing.T) { } func TestCloud_backendWithName(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() workspaces, err := b.Workspaces() @@ -574,7 +574,7 @@ func TestCloud_versionConstraints(t *testing.T) { } func TestCloud_localBackend(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() local, ok := b.local.(*backendLocal.Local) @@ -589,7 +589,7 @@ func TestCloud_localBackend(t *testing.T) { } func TestCloud_addAndRemoveWorkspacesDefault(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() if _, err := b.StateMgr(testBackendSingleWorkspaceName); err != nil { @@ -683,7 +683,7 @@ func TestCloud_addAndRemoveWorkspacesWithPrefix(t *testing.T) { } func TestCloud_checkConstraints(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() cases := map[string]struct { @@ -785,7 +785,7 @@ func TestCloud_checkConstraints(t *testing.T) { } func TestCloud_StateMgr_versionCheck(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() // Some fixed versions for testing with. This logic is a simple string @@ -846,7 +846,7 @@ func TestCloud_StateMgr_versionCheck(t *testing.T) { } func TestCloud_StateMgr_versionCheckLatest(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() v0140 := version.Must(version.NewSemver("0.14.0")) @@ -903,7 +903,7 @@ func TestCloud_VerifyWorkspaceTerraformVersion(t *testing.T) { } for _, tc := range testCases { t.Run(fmt.Sprintf("local %s, remote %s", tc.local, tc.remote), func(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() local := version.Must(version.NewSemver(tc.local)) @@ -955,7 +955,7 @@ func TestCloud_VerifyWorkspaceTerraformVersion(t *testing.T) { } func TestCloud_VerifyWorkspaceTerraformVersion_workspaceErrors(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() // Attempting to check the version against a workspace which doesn't exist @@ -997,7 +997,7 @@ func TestCloud_VerifyWorkspaceTerraformVersion_workspaceErrors(t *testing.T) { } func TestCloud_VerifyWorkspaceTerraformVersion_ignoreFlagSet(t *testing.T) { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() // If the ignore flag is set, the behaviour changes diff --git a/internal/cloud/testing.go b/internal/cloud/testing.go index 9dd570e69..b2811fe2f 100644 --- a/internal/cloud/testing.go +++ b/internal/cloud/testing.go @@ -65,7 +65,7 @@ func testInput(t *testing.T, answers map[string]string) *mockInput { return &mockInput{answers: answers} } -func testBackendDefault(t *testing.T) (*Cloud, func()) { +func testBackendWithName(t *testing.T) (*Cloud, func()) { obj := cty.ObjectVal(map[string]cty.Value{ "hostname": cty.NullVal(cty.String), "organization": cty.StringVal("hashicorp"), @@ -126,7 +126,7 @@ func testBackendNoOperations(t *testing.T) (*Cloud, func()) { } func testRemoteClient(t *testing.T) remote.Client { - b, bCleanup := testBackendDefault(t) + b, bCleanup := testBackendWithName(t) defer bCleanup() raw, err := b.StateMgr(testBackendSingleWorkspaceName)