mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
examine output format before return, fail the test instead of panic
This commit is contained in:
parent
649f6dbf61
commit
0d500921ea
@ -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
|
// 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
|
// desired stdout in this format: client_address=x.x.x.x
|
||||||
outputs := strings.Split(strings.TrimSpace(stdout), "=")
|
outputs := strings.Split(strings.TrimSpace(stdout), "=")
|
||||||
sourceIp := outputs[1]
|
if len(outputs) != 2 {
|
||||||
|
// fail the test if output format is unexpected
|
||||||
return execPodIp, sourceIp
|
framework.Failf("exec pod returned unexpected stdout format: [%v]\n", stdout)
|
||||||
|
return execPodIp, ""
|
||||||
|
}
|
||||||
|
return execPodIp, outputs[1]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user