Skip to content

Commit

Permalink
Feedback: restructure testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
btromanova committed Sep 24, 2019
1 parent 4ded222 commit 3144964
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions astro/cli/astro/cmd/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,37 @@ func TestPlanErrorOnMissingValues(t *testing.T) {
}

func TestPlanAllowedValues(t *testing.T) {
tt := []string{
"mgmt",
"dev",
"staging",
"prod",
testcases := []struct {
env string
expectedModules []string
}{
{
"mgmt",
[]string{"foo_mgmt-mgmt"},
},
{
"dev",
[]string{"misc-dev", "test_env-dev"},
},
{
"staging",
[]string{"misc-staging", "test_env-staging"},
},
{
"prod",
[]string{"misc-prod"},
},
}
expectedModules := map[string][]string{
"dev": []string{"misc-dev", "test_env-dev"},
"mgmt": []string{"foo_mgmt-mgmt"},
"staging": []string{"misc-staging", "test_env-staging"},
"prod": []string{"misc-prod"},
}
for _, env := range tt {
t.Run(env, func(t *testing.T) {
for _, tt := range testcases {
t.Run(tt.env, func(t *testing.T) {
result := tests.RunTest(t, []string{
"--config=merge_values.yaml",
"plan",
"--environment",
env,
tt.env,
}, "fixtures/flags", tests.VERSION_LATEST)
// Check that all expected modules were planned for environment env
for _, module := range expectedModules[env] {
// Check that all expected modules were planned for environment
for _, module := range tt.expectedModules {
assert.Contains(t, result.Stdout.String(), module)
}

Expand Down

0 comments on commit 3144964

Please sign in to comment.