Fix TestJSONOutput tests when failing on the specific command.

pull/12243/head
Andriy Dzikh 2021-08-12 09:25:27 -07:00
parent 6f608d3704
commit e7c190b326
1 changed files with 13 additions and 10 deletions

View File

@ -55,18 +55,21 @@ func TestJSONOutput(t *testing.T) {
for _, test := range tests {
t.Run(test.command, func(t *testing.T) {
args := []string{test.command, "-p", profile, "--output=json", "--user=testUser"}
args = append(args, test.args...)
var ces []*cloudEvent
t.Run("Command", func(t *testing.T) {
args := []string{test.command, "-p", profile, "--output=json", "--user=testUser"}
args = append(args, test.args...)
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if err != nil {
t.Errorf("failed to clean up: args %q: %v", rr.Command(), err)
}
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
if err != nil {
t.Errorf("failed to clean up: args %q: %v", rr.Command(), err)
}
ces, err := cloudEvents(t, rr)
if err != nil {
t.Fatalf("converting to cloud events: %v\n", err)
}
ces, err = cloudEvents(t, rr)
if err != nil {
t.Fatalf("converting to cloud events: %v\n", err)
}
})
t.Run("Audit", func(t *testing.T) {
got, err := auditContains("testUser")