From 6540cfaf315391c130824e942268b7b716f99191 Mon Sep 17 00:00:00 2001 From: anencore94 <37469330+anencore94@users.noreply.github.com> Date: Tue, 11 Feb 2020 05:44:53 +0900 Subject: [PATCH] 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 --- test/integration/start_stop_delete_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index a9a4d2a361..03fe3caa7c 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -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()) } } })