diff mbox

[ovs-dev,3/4] system-traffic: Wait for IPv6 connectivity.

Message ID 1462410066-41547-4-git-send-email-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer May 5, 2016, 1:01 a.m. UTC
Several of the tests have race conditions where the next step in the
test may run before the kernel actually provides IPv6 connectivity.
This causes intermittent testsuite failures. Some existing tests
would even sleep in an attempt to mitigate this issue.

Improve the resilience of these tests by waiting until IPv6 or FTP
connectivity are ready. This speeds the testsuite up by a couple of
percent.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 tests/system-traffic.at | 50 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 16 deletions(-)

Comments

Jarno Rajahalme May 5, 2016, 8:04 p.m. UTC | #1
Acked-by: Jarno Rajahalme <jarno@ovn.org>

> On May 4, 2016, at 6:01 PM, Joe Stringer <joe@ovn.org> wrote:
> 
> Several of the tests have race conditions where the next step in the
> test may run before the kernel actually provides IPv6 connectivity.
> This causes intermittent testsuite failures. Some existing tests
> would even sleep in an attempt to mitigate this issue.
> 
> Improve the resilience of these tests by waiting until IPv6 or FTP
> connectivity are ready. This speeds the testsuite up by a couple of
> percent.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
> tests/system-traffic.at | 50 +++++++++++++++++++++++++++++++++----------------
> 1 file changed, 34 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> index a5ec11775a7b..9a1769fdb1af 100644
> --- a/tests/system-traffic.at
> +++ b/tests/system-traffic.at
> @@ -79,9 +79,10 @@ ADD_NAMESPACES(at_ns0, at_ns1)
> ADD_VETH(p0, at_ns0, br0, "fc00::1/96")
> ADD_VETH(p1, at_ns1, br0, "fc00::2/96")
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
> 3 packets transmitted, 3 received, 0% packet loss, time 0ms
> @@ -109,9 +110,10 @@ ADD_VETH(p1, at_ns1, br0, "fc00::2/96")
> ADD_VLAN(p0, at_ns0, 100, "fc00:1::1/96")
> ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96")
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl
> 3 packets transmitted, 3 received, 0% packet loss, time 0ms
> @@ -351,9 +353,10 @@ priority=100,in_port=2,ct_state=+trk+est,tcp6,action=1
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> dnl HTTP requests from ns0->ns1 should work fine.
> NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py http6]], [http0.pid])
> @@ -1262,6 +1265,11 @@ table=1 priority=0, action=drop
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> +dnl "connect: Cannot assign requested address"
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
> +
> NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
> 
> dnl FTP requests from p0->p1 should work fine.
> @@ -1475,9 +1483,10 @@ priority=100,icmp6,icmp_type=136,action=normal
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> dnl Basic connectivity check.
> NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
> @@ -1522,9 +1531,10 @@ priority=100,icmp6,icmp_type=136,action=normal
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> dnl Basic connectivity check.
> NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
> @@ -1565,9 +1575,10 @@ priority=100,icmp6,icmp_type=136,action=normal
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> dnl Basic connectivity check.
> NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl
> @@ -1673,9 +1684,10 @@ ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], ["fc00::2/96"])
> ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], ["fc00::1/96"],
>                   [id 0 dstport 4789])
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> dnl First, check the underlay
> NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl
> @@ -2224,9 +2236,10 @@ priority=200,in_port=2,ct_state=+trk+new,icmp6,icmpv6_code=0,icmpv6_type=135,nd_
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> -dnl Without this sleep, we get occasional failures due to the following error:
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> dnl "connect: Cannot assign requested address"
> -sleep 2;
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> 
> dnl HTTP requests from ns0->ns1 should work fine.
> NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py http6]], [http0.pid])
> @@ -2280,6 +2293,11 @@ table=1 priority=0, action=drop
> 
> AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> 
> +dnl Linux seems to take a little time to get its IPv6 stack in order. Without
> +dnl waiting, we get occasional failures due to the following error:
> +dnl "connect: Cannot assign requested address"
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
> +
> NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
> 
> dnl FTP requests from p0->p1 should work fine.
> -- 
> 2.1.4
>
Joe Stringer May 10, 2016, 8:07 p.m. UTC | #2
On 5 May 2016 at 13:04, Jarno Rajahalme <jarno@ovn.org> wrote:
> Acked-by: Jarno Rajahalme <jarno@ovn.org>

Thanks, applied.
diff mbox

Patch

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index a5ec11775a7b..9a1769fdb1af 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -79,9 +79,10 @@  ADD_NAMESPACES(at_ns0, at_ns1)
 ADD_VETH(p0, at_ns0, br0, "fc00::1/96")
 ADD_VETH(p1, at_ns1, br0, "fc00::2/96")
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -109,9 +110,10 @@  ADD_VETH(p1, at_ns1, br0, "fc00::2/96")
 ADD_VLAN(p0, at_ns0, 100, "fc00:1::1/96")
 ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96")
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], [0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
@@ -351,9 +353,10 @@  priority=100,in_port=2,ct_state=+trk+est,tcp6,action=1
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl HTTP requests from ns0->ns1 should work fine.
 NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py http6]], [http0.pid])
@@ -1262,6 +1265,11 @@  table=1 priority=0, action=drop
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
+dnl "connect: Cannot assign requested address"
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
+
 NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
 
 dnl FTP requests from p0->p1 should work fine.
@@ -1475,9 +1483,10 @@  priority=100,icmp6,icmp_type=136,action=normal
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl Basic connectivity check.
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
@@ -1522,9 +1531,10 @@  priority=100,icmp6,icmp_type=136,action=normal
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl Basic connectivity check.
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00::2 | FORMAT_PING], [0], [dnl
@@ -1565,9 +1575,10 @@  priority=100,icmp6,icmp_type=136,action=normal
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl Basic connectivity check.
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::4 | FORMAT_PING], [0], [dnl
@@ -1673,9 +1684,10 @@  ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], ["fc00::2/96"])
 ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], ["fc00::1/96"],
                   [id 0 dstport 4789])
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl First, check the underlay
 NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl
@@ -2224,9 +2236,10 @@  priority=200,in_port=2,ct_state=+trk+new,icmp6,icmpv6_code=0,icmpv6_type=135,nd_
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
-dnl Without this sleep, we get occasional failures due to the following error:
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-sleep 2;
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
 dnl HTTP requests from ns0->ns1 should work fine.
 NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py http6]], [http0.pid])
@@ -2280,6 +2293,11 @@  table=1 priority=0, action=drop
 
 AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
+dnl Linux seems to take a little time to get its IPv6 stack in order. Without
+dnl waiting, we get occasional failures due to the following error:
+dnl "connect: Cannot assign requested address"
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
+
 NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
 
 dnl FTP requests from p0->p1 should work fine.