From 2798f4468b2dfa40dccb66259ab5d526e6b24dac Mon Sep 17 00:00:00 2001 From: lilyLuLiu Date: Mon, 24 Jun 2024 17:50:54 +0800 Subject: [PATCH] [QE] fix not catch error for oc login,https://github.com/crc-org/crc/issues/4101 --- test/extended/util/util.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/extended/util/util.go b/test/extended/util/util.go index f717e06ead..692c62af7c 100644 --- a/test/extended/util/util.go +++ b/test/extended/util/util.go @@ -269,7 +269,14 @@ func LoginToOcCluster(options []string) error { ocLoginAsAdminCommand = ocLoginAsAdminCommand + " " + option } - return ExecuteCommand(ocLoginAsAdminCommand) + err = ExecuteCommand(ocLoginAsAdminCommand) + + exitcode := GetLastCommandOutput("exitcode") + if exitcode != "0" { + stderr := GetLastCommandOutput("stderr") + return fmt.Errorf(stderr) + } + return err } // LoginToOcClusterSucceedsOrFails is a wrapper for LoginToOcCluster