fix integration test for tabular view

pull/6274/head
Medya Gh 2020-01-10 16:39:17 -08:00
parent 6c7cadb371
commit b36bc1ec66
1 changed files with 5 additions and 22 deletions

View File

@ -563,31 +563,14 @@ func validateAddonsCmd(ctx context.Context, t *testing.T, profile string) {
}
}
// Custom format
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "list", "--format", `"{{.AddonName}}":"{{.AddonStatus}}"`))
// Table output
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "list"))
if err != nil {
t.Errorf("%s failed: %v", rr.Args, err)
}
listLines = strings.Split(strings.TrimSpace(rr.Stdout.String()), "\n")
r = regexp.MustCompile(`"[a-z|-]+":"(enabled|disabled)"`)
for _, line := range listLines {
match := r.MatchString(line)
if !match {
t.Errorf("Plugin output did not match expected custom format. Got: %s", line)
}
}
// Custom format shorthand
rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "addons", "list", "-f", `"{{.AddonName}}":"{{.AddonStatus}}"`))
if err != nil {
t.Errorf("%s failed: %v", rr.Args, err)
}
listLines = strings.Split(strings.TrimSpace(rr.Stdout.String()), "\n")
r = regexp.MustCompile(`"[a-z|-]+":"(enabled|disabled)"`)
for _, line := range listLines {
match := r.MatchString(line)
if !match {
t.Errorf("Plugin output did not match expected custom format. Got: %s", line)
for _, a := range []string{"dashboard", "ingress", "ingress-dns"} {
if !strings.Contains(rr.Output(), a) {
t.Errorf("addon list expected to include %q but didn't output: %q", a, rr.Output())
}
}