From 86f93a2cbc4ab5dc6cef7a3adfb08a497f2f97ce Mon Sep 17 00:00:00 2001 From: Omar Ismail Date: Tue, 19 Oct 2021 17:06:41 -0400 Subject: [PATCH] Cloud UX test fixes --- internal/cloud/e2e/apply_auto_approve_test.go | 10 +++---- internal/cloud/e2e/helper_test.go | 2 +- .../e2e/migrate_state_multi_to_tfc_test.go | 4 +-- ...igrate_state_remote_backend_to_tfc_test.go | 28 +++++++++---------- .../e2e/migrate_state_single_to_tfc_test.go | 8 +++--- .../e2e/migrate_state_tfc_to_other_test.go | 2 +- .../e2e/migrate_state_tfc_to_tfc_test.go | 28 +++++++++---------- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/internal/cloud/e2e/apply_auto_approve_test.go b/internal/cloud/e2e/apply_auto_approve_test.go index 8e10feb08..626f4c272 100644 --- a/internal/cloud/e2e/apply_auto_approve_test.go +++ b/internal/cloud/e2e/apply_auto_approve_test.go @@ -18,7 +18,7 @@ import ( func Test_terraform_apply_autoApprove(t *testing.T) { ctx := context.Background() tfVersion := "1.1.0-tfc-integration" - if !hasTerraformVersion(version) { + if !hasTerraformVersion(t, tfVersion) { t.Skip("Skipping test because TFC does not have current terraform version.") } @@ -42,7 +42,7 @@ func Test_terraform_apply_autoApprove(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"apply"}, @@ -82,7 +82,7 @@ func Test_terraform_apply_autoApprove(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"apply"}, @@ -122,7 +122,7 @@ func Test_terraform_apply_autoApprove(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"apply", "-auto-approve"}, @@ -160,7 +160,7 @@ func Test_terraform_apply_autoApprove(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"apply", "-auto-approve"}, diff --git a/internal/cloud/e2e/helper_test.go b/internal/cloud/e2e/helper_test.go index af585004b..a9f4313ff 100644 --- a/internal/cloud/e2e/helper_test.go +++ b/internal/cloud/e2e/helper_test.go @@ -197,7 +197,7 @@ func writeMainTF(t *testing.T, block string, dir string) { } // Ensure that TFC/E has a particular terraform version. -func hasTerraformVersion(version string) bool { +func hasTerraformVersion(t *testing.T, version string) bool { opts := tfe.AdminTerraformVersionsListOptions{ ListOptions: tfe.ListOptions{ PageNumber: 1, 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 d7916a046..c9b837019 100644 --- a/internal/cloud/e2e/migrate_state_multi_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_multi_to_tfc_test.go @@ -68,7 +68,7 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) { userInput: []string{"yes", "yes"}, postInputOutput: []string{ `Do you want to copy existing state to Terraform Cloud?`, - `Successfully configured Terraform Cloud!`}, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -309,7 +309,7 @@ func Test_migrate_multi_to_tfc_cloud_tags_strategy(t *testing.T) { `Would you like to rename your workspaces?`, "What pattern would you like to add to all your workspaces?", "The currently selected workspace (prod) does not exist.", - "Terraform has been successfully initialized!"}, + "Terraform Cloud has been successfully initialized!"}, }, { command: []string{"workspace", "select", "app-prod"}, 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 0cb7d5efc..e6402e876 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 @@ -50,9 +50,9 @@ func Test_migrate_remote_backend_name_to_tfc_name(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `Do you want to copy existing state to the new backend?`, + expectedCmdOutput: `Do you want to copy existing state to Terraform Cloud?`, userInput: []string{"yes"}, - postInputOutput: []string{`Successfully configured Terraform Cloud!`}, + postInputOutput: []string{`Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -102,7 +102,7 @@ func Test_migrate_remote_backend_name_to_tfc_name(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `Terraform has been successfully initialized!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"workspace", "show"}, @@ -232,9 +232,9 @@ func Test_migrate_remote_backend_name_to_tfc_name_different_org(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `Do you want to copy existing state to the new backend?`, + expectedCmdOutput: `Do you want to copy existing state to Terraform Cloud?`, userInput: []string{"yes"}, - postInputOutput: []string{`Successfully configured Terraform Cloud!`}, + postInputOutput: []string{`Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -376,8 +376,8 @@ func Test_migrate_remote_backend_name_to_tfc_tags(t *testing.T) { expectedCmdOutput: `Terraform Cloud configuration only allows named workspaces!`, userInput: []string{"cloud-workspace", "yes"}, postInputOutput: []string{ - `Do you want to copy existing state to the new backend?`, - `Successfully configured the backend "cloud"!`}, + `Do you want to copy existing state to Terraform Cloud?`, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -513,10 +513,10 @@ func Test_migrate_remote_backend_prefix_to_tfc_name(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `Do you want to copy existing state to the new backend?`, + expectedCmdOutput: `Do you want to copy existing state to Terraform Cloud?`, userInput: []string{"yes"}, postInputOutput: []string{ - `Successfully configured Terraform Cloud!`}, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -581,7 +581,7 @@ func Test_migrate_remote_backend_prefix_to_tfc_name(t *testing.T) { expectedCmdOutput: `Do you want to copy only your current workspace?`, userInput: []string{"yes"}, postInputOutput: []string{ - `Successfully configured the backend "cloud"!`}, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -731,11 +731,11 @@ func Test_migrate_remote_backend_prefix_to_tfc_tags(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `The "cloud" backend configuration only allows named workspaces!`, + expectedCmdOutput: `The Terraform Cloud configuration only allows named workspaces!`, userInput: []string{"cloud-workspace", "yes"}, postInputOutput: []string{ - `Do you want to copy existing state to the new backend?`, - `Successfully configured the backend "cloud"!`}, + `Do you want to copy existing state to Terraform Cloud?`, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "list"}, @@ -801,7 +801,7 @@ func Test_migrate_remote_backend_prefix_to_tfc_tags(t *testing.T) { expectedCmdOutput: `Would you like to rename your workspaces?`, userInput: []string{"1", "*"}, postInputOutput: []string{`What pattern would you like to add to all your workspaces?`, - `Successfully configured the backend "cloud"!`}, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, 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 d89396f4c..d8423f428 100644 --- a/internal/cloud/e2e/migrate_state_single_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_single_to_tfc_test.go @@ -50,9 +50,9 @@ func Test_migrate_single_to_tfc(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state"}, - expectedCmdOutput: `Do you want to copy existing state to the Terraform Cloud?`, + expectedCmdOutput: `Do you want to copy existing state to Terraform Cloud?`, userInput: []string{"yes"}, - postInputOutput: []string{`Successfully configured Terraform Cloud!`}, + postInputOutput: []string{`Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "list"}, @@ -104,8 +104,8 @@ func Test_migrate_single_to_tfc(t *testing.T) { expectedCmdOutput: `Terraform Cloud configuration only allows named workspaces!`, userInput: []string{"new-workspace", "yes"}, postInputOutput: []string{ - `Do you want to copy existing state to the new backend?`, - `Successfully configured Terraform Cloud!`}, + `Do you want to copy existing state to Terraform Cloud?`, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "list"}, diff --git a/internal/cloud/e2e/migrate_state_tfc_to_other_test.go b/internal/cloud/e2e/migrate_state_tfc_to_other_test.go index 08a5e703a..a7b807191 100644 --- a/internal/cloud/e2e/migrate_state_tfc_to_other_test.go +++ b/internal/cloud/e2e/migrate_state_tfc_to_other_test.go @@ -28,7 +28,7 @@ func Test_migrate_tfc_to_other(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, }, }, 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 39ae98003..ab5d908ed 100644 --- a/internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go +++ b/internal/cloud/e2e/migrate_state_tfc_to_tfc_test.go @@ -17,7 +17,7 @@ import ( func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { ctx := context.Background() tfVersion := "1.1.0-tfc-integration" - if !hasTerraformVersion(version) { + if !hasTerraformVersion(t, tfVersion) { t.Skip("Skipping test because TFC does not have current terraform version.") } @@ -49,7 +49,7 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"workspace", "show"}, @@ -76,9 +76,9 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `Do you want to copy existing state to the new backend?`, + expectedCmdOutput: `Do you want to copy existing state to Terraform Cloud?`, userInput: []string{"yes"}, - postInputOutput: []string{`Successfully configured the backend "cloud"!`}, + postInputOutput: []string{`Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -117,7 +117,7 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { commands: []tfCommand{ { command: []string{"init"}, - expectedCmdOutput: `Successfully configured the backend "cloud"!`, + expectedCmdOutput: `Terraform Cloud has been successfully initialized!`, }, { command: []string{"apply"}, @@ -136,11 +136,11 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { commands: []tfCommand{ { command: []string{"init", "-migrate-state", "-ignore-remote-version"}, - expectedCmdOutput: `The "cloud" backend configuration only allows named workspaces!`, + expectedCmdOutput: `The Terraform Cloud configuration only allows named workspaces!`, userInput: []string{"new-workspace", "yes"}, postInputOutput: []string{ - `Do you want to copy existing state to the new backend?`, - `Successfully configured the backend "cloud"!`}, + `Do you want to copy existing state to Terraform Cloud?`, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -240,7 +240,7 @@ func Test_migrate_tfc_to_tfc_single_workspace(t *testing.T) { func Test_migrate_tfc_to_tfc_multiple_workspace(t *testing.T) { ctx := context.Background() tfVersion := "1.1.0-tfc-integration" - if !hasTerraformVersion(version) { + if !hasTerraformVersion(t, tfVersion) { t.Skip("Skipping test because TFC does not have current terraform version.") } @@ -276,7 +276,7 @@ func Test_migrate_tfc_to_tfc_multiple_workspace(t *testing.T) { command: []string{"init"}, expectedCmdOutput: `The currently selected workspace (default) does not exist.`, userInput: []string{"1"}, - postInputOutput: []string{`Terraform has been successfully initialized!`}, + postInputOutput: []string{`Terraform Cloud has been successfully initialized!`}, }, { command: []string{"apply"}, @@ -319,8 +319,8 @@ func Test_migrate_tfc_to_tfc_multiple_workspace(t *testing.T) { expectedCmdOutput: `Do you want to copy only your current workspace?`, userInput: []string{"yes", "yes"}, postInputOutput: []string{ - `Do you want to copy existing state to the new backend?`, - `Terraform has been successfully initialized!`}, + `Do you want to copy existing state to Terraform Cloud?`, + `Terraform Cloud has been successfully initialized!`}, }, { command: []string{"workspace", "show"}, @@ -370,7 +370,7 @@ func Test_migrate_tfc_to_tfc_multiple_workspace(t *testing.T) { command: []string{"init"}, expectedCmdOutput: `The currently selected workspace (default) does not exist.`, userInput: []string{"1"}, - postInputOutput: []string{`Terraform has been successfully initialized!`}, + postInputOutput: []string{`Terraform Cloud has been successfully initialized!`}, }, { command: []string{"apply", "-auto-approve"}, @@ -401,7 +401,7 @@ func Test_migrate_tfc_to_tfc_multiple_workspace(t *testing.T) { postInputOutput: []string{ `What pattern would you like to add to all your workspaces?`, `The currently selected workspace (app-staging) does not exist.`, - `Successfully configured the backend "cloud"!`}, + `Terraform Cloud has been successfully initialized!`}, }, }, },