test/distro: Avoid race between display of ns_msg and netcat exiting

The shell might report 'nc -6 -l -p 9999 > /tmp/ns_msg' as done
even after the subsequent 'echo' is done: wait one second before
reading out /tmp/ns_msg, to ensure we read that instead of the
"Done" message.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-01-30 03:09:46 +01:00
parent 292c185553
commit ec7b65fd79
4 changed files with 4 additions and 0 deletions

View file

@ -26,6 +26,7 @@ sleep 2
host echo "from_ns" | nc -q0 ::1 10000 host echo "from_ns" | nc -q0 ::1 10000
sleep 2 sleep 2
host echo host echo
sleep 1
hout NS_MSG cat /tmp/ns_msg hout NS_MSG cat /tmp/ns_msg
check [ __NS_MSG__ = "from_init" ] check [ __NS_MSG__ = "from_init" ]
hostb exit hostb exit

View file

@ -25,6 +25,7 @@ sleep 2
host echo "from_ns" | nc ::1 10000 host echo "from_ns" | nc ::1 10000
sleep 2 sleep 2
host echo host echo
sleep 1
hout NS_MSG cat /tmp/ns_msg hout NS_MSG cat /tmp/ns_msg
check [ __NS_MSG__ = "from_init" ] check [ __NS_MSG__ = "from_init" ]
hostb exit hostb exit

View file

@ -25,6 +25,7 @@ sleep 2
host echo "from_ns" | nc -N ::1 10000 host echo "from_ns" | nc -N ::1 10000
sleep 2 sleep 2
host echo host echo
sleep 1
hout NS_MSG cat /tmp/ns_msg hout NS_MSG cat /tmp/ns_msg
check [ __NS_MSG__ = "from_init" ] check [ __NS_MSG__ = "from_init" ]
hostb exit hostb exit

View file

@ -25,6 +25,7 @@ sleep 2
host echo "from_ns" | nc -q0 ::1 10000 host echo "from_ns" | nc -q0 ::1 10000
sleep 2 sleep 2
host echo host echo
sleep 1
hout NS_MSG cat /tmp/ns_msg hout NS_MSG cat /tmp/ns_msg
check [ __NS_MSG__ = "from_init" ] check [ __NS_MSG__ = "from_init" ]
hostb exit hostb exit