mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +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
|
||||
// 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]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user