|
|
|
|
@ -33,7 +33,8 @@ func testOperationApply(t *testing.T, configDir string) (*backend.Operation, fun
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyBasic(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -76,7 +77,8 @@ func TestRemote_applyBasic(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithoutPermissions(t *testing.T) {
|
|
|
|
|
b := testBackendNoDefault(t)
|
|
|
|
|
b, bCleanup := testBackendNoDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
// Create a named workspace without permissions.
|
|
|
|
|
w, err := b.client.Workspaces.Create(
|
|
|
|
|
@ -114,7 +116,8 @@ func TestRemote_applyWithoutPermissions(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithVCS(t *testing.T) {
|
|
|
|
|
b := testBackendNoDefault(t)
|
|
|
|
|
b, bCleanup := testBackendNoDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
// Create a named workspace with a VCS.
|
|
|
|
|
_, err := b.client.Workspaces.Create(
|
|
|
|
|
@ -154,7 +157,8 @@ func TestRemote_applyWithVCS(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithParallelism(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -179,7 +183,8 @@ func TestRemote_applyWithParallelism(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithPlan(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -207,7 +212,8 @@ func TestRemote_applyWithPlan(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithoutRefresh(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -232,7 +238,8 @@ func TestRemote_applyWithoutRefresh(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithTarget(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -262,7 +269,8 @@ func TestRemote_applyWithTarget(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithVariables(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-variables")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -287,7 +295,8 @@ func TestRemote_applyWithVariables(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyNoConfig(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/empty")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -314,7 +323,8 @@ func TestRemote_applyNoConfig(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyNoChanges(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-no-changes")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -344,7 +354,8 @@ func TestRemote_applyNoChanges(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyNoApprove(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -381,7 +392,8 @@ func TestRemote_applyNoApprove(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyAutoApprove(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -425,7 +437,8 @@ func TestRemote_applyAutoApprove(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithAutoApply(t *testing.T) {
|
|
|
|
|
b := testBackendNoDefault(t)
|
|
|
|
|
b, bCleanup := testBackendNoDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
// Create a named workspace that auto applies.
|
|
|
|
|
_, err := b.client.Workspaces.Create(
|
|
|
|
|
@ -488,7 +501,8 @@ func TestRemote_applyForceLocal(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
defer os.Unsetenv("TF_FORCE_LOCAL_BACKEND")
|
|
|
|
|
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -531,7 +545,9 @@ func TestRemote_applyForceLocal(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWorkspaceWithoutOperations(t *testing.T) {
|
|
|
|
|
b := testBackendNoDefault(t)
|
|
|
|
|
b, bCleanup := testBackendNoDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
|
|
// Create a named workspace that doesn't allow operations.
|
|
|
|
|
@ -587,7 +603,9 @@ func TestRemote_applyWorkspaceWithoutOperations(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyLockTimeout(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
|
|
// Retrieve the workspace used to run this operation in.
|
|
|
|
|
@ -659,7 +677,8 @@ func TestRemote_applyLockTimeout(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyDestroy(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-destroy")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -703,7 +722,8 @@ func TestRemote_applyDestroy(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyDestroyNoConfig(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
input := testInput(t, map[string]string{
|
|
|
|
|
"approve": "yes",
|
|
|
|
|
@ -736,7 +756,8 @@ func TestRemote_applyDestroyNoConfig(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyPolicyPass(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-policy-passed")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -782,7 +803,8 @@ func TestRemote_applyPolicyPass(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyPolicyHardFail(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-policy-hard-failed")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -833,7 +855,8 @@ func TestRemote_applyPolicyHardFail(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyPolicySoftFail(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-policy-soft-failed")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -880,7 +903,8 @@ func TestRemote_applyPolicySoftFail(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyPolicySoftFailAutoApprove(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-policy-soft-failed")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
@ -932,7 +956,8 @@ func TestRemote_applyPolicySoftFailAutoApprove(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyPolicySoftFailAutoApply(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
// Create a named workspace that auto applies.
|
|
|
|
|
_, err := b.client.Workspaces.Create(
|
|
|
|
|
@ -992,7 +1017,8 @@ func TestRemote_applyPolicySoftFailAutoApply(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemote_applyWithRemoteError(t *testing.T) {
|
|
|
|
|
b := testBackendDefault(t)
|
|
|
|
|
b, bCleanup := testBackendDefault(t)
|
|
|
|
|
defer bCleanup()
|
|
|
|
|
|
|
|
|
|
op, configCleanup := testOperationApply(t, "./test-fixtures/apply-with-error")
|
|
|
|
|
defer configCleanup()
|
|
|
|
|
|