Cloud UX test fixes
This commit is contained in:
parent
09d5b70b7a
commit
86f93a2cbc
|
@ -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"},
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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!`,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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!`},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue