diff --git a/internal/cloud/e2e/backend_apply_before_init_test.go b/internal/cloud/e2e/backend_apply_before_init_test.go index e389e4364066..5419362db915 100644 --- a/internal/cloud/e2e/backend_apply_before_init_test.go +++ b/internal/cloud/e2e/backend_apply_before_init_test.go @@ -50,10 +50,8 @@ func Test_backend_apply_before_init(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "local"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, diff --git a/internal/cloud/e2e/migrate_state_multi_to_tfc_test.go b/internal/cloud/e2e/migrate_state_multi_to_tfc_test.go index c511503c4cc3..5ef34ec985eb 100644 --- a/internal/cloud/e2e/migrate_state_multi_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_multi_to_tfc_test.go @@ -38,20 +38,16 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "local"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "new", "prod"}, expectedCmdOutput: `Created and switched to workspace "prod"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "select", "default"}, @@ -113,20 +109,16 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "local"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "new", "prod"}, expectedCmdOutput: `Created and switched to workspace "prod"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -268,20 +260,16 @@ func Test_migrate_multi_to_tfc_cloud_tags_strategy(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "local"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "new", "prod"}, expectedCmdOutput: `Created and switched to workspace "prod"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "select", "default"}, diff --git a/internal/cloud/e2e/migrate_state_remote_backend_to_tfc_test.go b/internal/cloud/e2e/migrate_state_remote_backend_to_tfc_test.go index e5c64900dea8..54d8b7bc24cc 100644 --- a/internal/cloud/e2e/migrate_state_remote_backend_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_remote_backend_to_tfc_test.go @@ -37,10 +37,8 @@ func Test_migrate_remote_backend_name_to_tfc_name(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "remote"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "remote-workspace"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -89,10 +87,8 @@ func Test_migrate_remote_backend_name_to_tfc_name(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "remote"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "remote-workspace"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -223,10 +219,8 @@ func Test_migrate_remote_backend_name_to_tfc_name_different_org(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "remote"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "remote-workspace"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -364,10 +358,8 @@ func Test_migrate_remote_backend_name_to_tfc_tags(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "remote"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "remote-workspace"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "show"}, @@ -512,10 +504,8 @@ func Test_migrate_remote_backend_prefix_to_tfc_name(t *testing.T) { expectedCmdOutput: `Terraform has been successfully initialized!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "app-one"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -569,10 +559,8 @@ func Test_migrate_remote_backend_prefix_to_tfc_name(t *testing.T) { postInputOutput: []string{`Terraform has been successfully initialized!`}, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "app-one"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, { command: []string{"workspace", "list"}, diff --git a/internal/cloud/e2e/migrate_state_single_to_tfc_test.go b/internal/cloud/e2e/migrate_state_single_to_tfc_test.go index 8abb5ae89920..6843107d424d 100644 --- a/internal/cloud/e2e/migrate_state_single_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_single_to_tfc_test.go @@ -37,10 +37,8 @@ func Test_migrate_single_to_tfc(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "local"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -88,10 +86,8 @@ func Test_migrate_single_to_tfc(t *testing.T) { expectedCmdOutput: `Successfully configured the backend "local"!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, diff --git a/internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go b/internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go index 52f2b6259db4..9488bb11dd31 100644 --- a/internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go @@ -55,10 +55,8 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { expectedCmdOutput: `prod`, // this comes from the `prep` function }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "prod"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -119,10 +117,8 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "prod"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, @@ -183,10 +179,8 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { - command: []string{"apply"}, - expectedCmdOutput: `Do you want to perform these actions in workspace "prod"?`, - userInput: []string{"yes"}, - postInputOutput: []string{`Apply complete!`}, + command: []string{"apply", "-auto-approve"}, + postInputOutput: []string{`Apply complete!`}, }, }, }, diff --git a/internal/cloud/e2e/run_variables_test.go b/internal/cloud/e2e/run_variables_test.go index 46aa53959655..f8ac2efa8890 100644 --- a/internal/cloud/e2e/run_variables_test.go +++ b/internal/cloud/e2e/run_variables_test.go @@ -116,7 +116,7 @@ func Test_cloud_run_variables(t *testing.T) { if tfCmd.expectedCmdOutput != "" { _, err := exp.ExpectString(tfCmd.expectedCmdOutput) if err != nil { - t.Fatal(err) + t.Fatalf(`Expected command output "%s", but got %v `, tfCmd.expectedCmdOutput, err) } } @@ -132,7 +132,7 @@ func Test_cloud_run_variables(t *testing.T) { output := tfCmd.postInputOutput[i] _, err := exp.ExpectString(output) if err != nil { - t.Fatal(err) + t.Fatalf(`Expected command output "%s", but got %v `, tfCmd.expectedCmdOutput, err) } } }