e2e: fix panic when checking error

fix panic during error handling

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 09df2c6091)
This commit is contained in:
Madhu Rajanna 2022-09-02 13:47:00 +05:30 committed by mergify[bot]
parent 8e55583c27
commit 9424269d86

View File

@ -214,11 +214,14 @@ func validateOmapCount(f *framework.Framework, count int, driver, pool, mode str
filterLessCmds := []string{cmds.radosLsCmd, cmds.radosLsKeysCmd} filterLessCmds := []string{cmds.radosLsCmd, cmds.radosLsKeysCmd}
for i, cmd := range filterCmds { for i, cmd := range filterCmds {
stdOut, stdErr, err := execCommandInToolBoxPod(f, cmd, rookNamespace) stdOut, stdErr, err := execCommandInToolBoxPod(f, cmd, rookNamespace)
if err != nil || stdErr != "" { if err != nil {
if !strings.Contains(err.Error(), exitOneErr) { if !strings.Contains(err.Error(), exitOneErr) {
e2elog.Failf("failed to execute rados command '%s' : err=%v stdErr=%s", cmd, err, stdErr) e2elog.Failf("failed to execute rados command '%s' : err=%v stdErr=%s", cmd, err, stdErr)
} }
} }
if stdErr != "" {
e2elog.Failf("failed to execute rados command '%s' : stdErr=%s", cmd, stdErr)
}
err = compareStdoutWithCount(stdOut, count) err = compareStdoutWithCount(stdOut, count)
if err == nil { if err == nil {
continue continue