Update tests for new prompts
* Remove double question to migrate * Remove parallelism (it has been flaky) * Add subtests to apply_auto_approve_test (it was overlooked before)
This commit is contained in:
parent
7d6d31eff8
commit
7aeaec9b48
|
@ -179,7 +179,10 @@ func Test_terraform_apply_autoApprove(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for name, tc := range cases {
|
||||||
|
tc := tc
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
@ -237,7 +240,7 @@ func Test_terraform_apply_autoApprove(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
err = cmd.Wait()
|
err = cmd.Wait()
|
||||||
if err != nil {
|
if err != nil && !tfCmd.expectError {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,5 +249,6 @@ func Test_terraform_apply_autoApprove(t *testing.T) {
|
||||||
if tc.validations != nil {
|
if tc.validations != nil {
|
||||||
tc.validations(t, organization.Name)
|
tc.validations(t, organization.Name)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func Test_backend_apply_before_init(t *testing.T) {
|
func Test_backend_apply_before_init(t *testing.T) {
|
||||||
skipIfMissingEnvVar(t)
|
skipIfMissingEnvVar(t)
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
skipWithoutRemoteTerraformVersion(t)
|
skipWithoutRemoteTerraformVersion(t)
|
||||||
|
|
||||||
cases := map[string]struct {
|
cases := map[string]struct {
|
||||||
|
@ -74,7 +74,7 @@ func Test_backend_apply_before_init(t *testing.T) {
|
||||||
for name, tc := range cases {
|
for name, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
@ -130,6 +130,7 @@ func Test_backend_apply_before_init(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = cmd.Wait()
|
err = cmd.Wait()
|
||||||
if err != nil && !tfCmd.expectError {
|
if err != nil && !tfCmd.expectError {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func Test_init_with_empty_tags(t *testing.T) {
|
func Test_init_with_empty_tags(t *testing.T) {
|
||||||
skipIfMissingEnvVar(t)
|
skipIfMissingEnvVar(t)
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
skipWithoutRemoteTerraformVersion(t)
|
skipWithoutRemoteTerraformVersion(t)
|
||||||
|
|
||||||
cases := map[string]struct {
|
cases := map[string]struct {
|
||||||
|
@ -41,7 +41,7 @@ func Test_init_with_empty_tags(t *testing.T) {
|
||||||
for name, tc := range cases {
|
for name, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
|
|
@ -62,10 +62,8 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) {
|
||||||
{
|
{
|
||||||
command: []string{"init"},
|
command: []string{"init"},
|
||||||
expectedCmdOutput: `Do you want to copy only your current workspace?`,
|
expectedCmdOutput: `Do you want to copy only your current workspace?`,
|
||||||
userInput: []string{"yes", "yes"},
|
userInput: []string{"yes"},
|
||||||
postInputOutput: []string{
|
postInputOutput: []string{`Terraform Cloud has been successfully initialized!`},
|
||||||
`Do you want to copy existing state to Terraform Cloud?`,
|
|
||||||
`Terraform Cloud has been successfully initialized!`},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: []string{"workspace", "show"},
|
command: []string{"workspace", "show"},
|
||||||
|
@ -129,10 +127,8 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) {
|
||||||
{
|
{
|
||||||
command: []string{"init"},
|
command: []string{"init"},
|
||||||
expectedCmdOutput: `Do you want to copy only your current workspace?`,
|
expectedCmdOutput: `Do you want to copy only your current workspace?`,
|
||||||
userInput: []string{"yes", "yes"},
|
userInput: []string{"yes"},
|
||||||
postInputOutput: []string{
|
postInputOutput: []string{`Terraform Cloud has been successfully initialized!`},
|
||||||
`Do you want to copy existing state to Terraform Cloud?`,
|
|
||||||
`Terraform Cloud has been successfully initialized!`},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: []string{"workspace", "list"},
|
command: []string{"workspace", "list"},
|
||||||
|
@ -197,10 +193,8 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) {
|
||||||
{
|
{
|
||||||
command: []string{"init"},
|
command: []string{"init"},
|
||||||
expectedCmdOutput: `Do you want to copy only your current workspace?`,
|
expectedCmdOutput: `Do you want to copy only your current workspace?`,
|
||||||
userInput: []string{"yes", "yes"},
|
userInput: []string{"yes"},
|
||||||
postInputOutput: []string{
|
postInputOutput: []string{`Terraform Cloud has been successfully initialized!`},
|
||||||
`Do you want to copy existing state to Terraform Cloud?`,
|
|
||||||
`Terraform Cloud has been successfully initialized!`},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: []string{"workspace", "select", "default"},
|
command: []string{"workspace", "select", "default"},
|
||||||
|
@ -233,7 +227,7 @@ func Test_migrate_multi_to_tfc_cloud_name_strategy(t *testing.T) {
|
||||||
for name, tc := range cases {
|
for name, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
@ -521,7 +515,7 @@ func Test_migrate_multi_to_tfc_cloud_tags_strategy(t *testing.T) {
|
||||||
for name, tc := range cases {
|
for name, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
|
|
@ -131,7 +131,7 @@ func Test_migrate_single_to_tfc(t *testing.T) {
|
||||||
for name, tc := range cases {
|
for name, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
|
|
@ -49,7 +49,7 @@ func Test_migrate_tfc_to_other(t *testing.T) {
|
||||||
for name, tc := range cases {
|
for name, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
// t.Parallel()
|
||||||
organization, cleanup := createOrganization(t)
|
organization, cleanup := createOrganization(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
exp, err := expect.NewConsole(defaultOpts()...)
|
exp, err := expect.NewConsole(defaultOpts()...)
|
||||||
|
|
Loading…
Reference in New Issue