Skip to content

Commit 94a4d2a

Browse files
Merge pull request #29845 from jcaamano/ovnk-ignore-stderr
NO-JIRA: OVNK: ignore stderr when running commands
2 parents a0471e8 + d15ff8c commit 94a4d2a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/extended/networking/egressip_helpers.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,28 +1930,31 @@ func sdnHostsubnetFlushEgressCIDRs(oc *exutil.CLI, nodeName string) error {
19301930
// runOcWithRetry runs the oc command with up to 5 retries if a timeout error occurred while running the command.
19311931
func runOcWithRetry(oc *exutil.CLI, cmd string, args ...string) (string, error) {
19321932
var err error
1933-
var output string
1933+
var stdout string
19341934
maxRetries := 5
19351935

19361936
for numRetries := 0; numRetries < maxRetries; numRetries++ {
19371937
if numRetries > 0 {
19381938
framework.Logf("Retrying oc command (retry count=%v/%v)", numRetries+1, maxRetries)
19391939
}
19401940

1941-
output, err = oc.Run(cmd).Args(args...).Output()
1941+
// stderrr can have spurious logs that can disrupt parsing done by
1942+
// callers, ignore it
1943+
stdout, _, err = oc.Run(cmd).Args(args...).Outputs()
19421944
// If an error was found, either return the error, or retry if a timeout error was found.
19431945
if err != nil {
19441946
if strings.Contains(strings.ToLower(err.Error()), "i/o timeout") {
19451947
// Retry on "i/o timeout" errors
19461948
framework.Logf("Warning: oc command encountered i/o timeout.\nerr=%v\n)", err)
19471949
continue
19481950
}
1949-
return output, err
1951+
return stdout, err
19501952
}
1953+
19511954
// Break out of loop if no error.
19521955
break
19531956
}
1954-
return output, err
1957+
return stdout, err
19551958
}
19561959

19571960
// listEgressIPs uses the dynamic admin client to return a pointer to

0 commit comments

Comments
 (0)