nc does not exit properly in the udp tests and can hang
For an unknown reason the `nc` process does not always exit. When we
already got the expected answer we can just tear it down via a trap.
@@ -3552,7 +3552,7 @@ func NewHelloWorldJobUDP(host string, port string) *k8sv1.Pod {
// local port is used to catch the reply - any number can be used
// we make it different than the port to be safe if both are running on the same machine
localPort--
- check := []string{fmt.Sprintf(`set -x; x="$(head -n 1 < <(echo | nc -up %d %s %s -i 1 -w 1 & nc -ul %d))"; echo "$x" ; if [ "$x" = "Hello UDP World!" ]; then echo "succeeded"; exit 0; else echo "failed"; exit 1; fi`,
+ check := []string{fmt.Sprintf(`set -x; trap "kill 0" EXIT; x="$(head -n 1 < <(echo | nc -up %d %s %s -i 1 -w 1 & nc -ul %d))"; echo "$x" ; if [ "$x" = "Hello UDP World!" ]; then echo "succeeded"; exit 0; else echo "failed"; exit 1; fi`,
localPort, host, port, localPort)}
job := RenderJob("netcat", []string{"/bin/bash", "-c"}, check)
