Update delete-config-context test (#6567)

update the test to use exitcode as as assertion
and to print stdout for debugging easily in error
case

Signed-off-by: anencore94 <anencore94@kaist.ac.kr>
pull/6582/head
anencore94 2020-02-11 05:44:53 +09:00 committed by GitHub
parent 96c33046be
commit 6540cfaf31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -154,12 +154,12 @@ func TestStartStop(t *testing.T) {
t.Errorf("%s failed: %v", rr.Args, err)
}
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "config", "get-contexts"))
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "config", "get-contexts", profile))
if err != nil {
t.Fatalf("%s failed: %v", rr.Args, err)
t.Logf("config context error: %v (may be ok)", err)
}
if notDeleted := strings.Contains(rr.Output(), profile); notDeleted {
t.Errorf(" kubeconfig of %s is not deleted = %t; want = %t", profile, notDeleted, false)
if rr.ExitCode != 1 {
t.Errorf("wanted exit code 1, got %d. output: %s", rr.ExitCode, rr.Output())
}
}
})