diff --git a/test/e2e/service.go b/test/e2e/service.go index 95967817a46..e436265db79 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -2347,7 +2347,10 @@ func execSourceipTest(f *framework.Framework, c *client.Client, ns, nodeName, se // the stdout return from RunHostCmd seems to come with "\n", so TrimSpace is needed // desired stdout in this format: client_address=x.x.x.x outputs := strings.Split(strings.TrimSpace(stdout), "=") - sourceIp := outputs[1] - - return execPodIp, sourceIp + if len(outputs) != 2 { + // fail the test if output format is unexpected + framework.Failf("exec pod returned unexpected stdout format: [%v]\n", stdout) + return execPodIp, "" + } + return execPodIp, outputs[1] }