From patchwork Tue Dec 20 21:28:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 707591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tjrWJ56vtz9t0w for ; Wed, 21 Dec 2016 08:28:44 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9053CC29; Tue, 20 Dec 2016 21:28:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 20C7FBF1 for ; Tue, 20 Dec 2016 21:28:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 72C1F1AD for ; Tue, 20 Dec 2016 21:28:39 +0000 (UTC) Received: from mfilter14-d.gandi.net (mfilter14-d.gandi.net [217.70.178.142]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 3E57EC5A77 for ; Tue, 20 Dec 2016 22:28:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter14-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter14-d.gandi.net (mfilter14-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 0uSGeyREKdhl for ; Tue, 20 Dec 2016 22:28:36 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 3F42AC5A5A for ; Tue, 20 Dec 2016 22:28:35 +0100 (CET) From: Joe Stringer To: dev@openvswitch.org Date: Tue, 20 Dec 2016 13:28:26 -0800 Message-Id: <20161220212829.19947-2-joe@ovn.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161220212829.19947-1-joe@ovn.org> References: <20161220212829.19947-1-joe@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/5] system-traffic: Wait for L7 servers to start. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Use OVS_WAIT_UNTIL() with netstat to ensure servers are listening before sending requests to them. This allows us to drop --retry-connrefused on wget, needed before we can switch to curl. Signed-off-by: Joe Stringer Acked-by: Daniele Di Proietto --- tests/system-common-macros.at | 4 ++++ tests/system-traffic.at | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at index eb5478d38d1b..90f6065c1ba4 100644 --- a/tests/system-common-macros.at +++ b/tests/system-common-macros.at @@ -238,6 +238,10 @@ m4_define([OVS_CHECK_FIREWALL], m4_define([OVS_START_L7], [PIDFILE=$(mktemp $2XXX.log) NETNS_DAEMONIZE([$1], [[$PYTHON $srcdir/test-l7.py $2]], [$PIDFILE]) + + dnl netstat doesn't print http over IPv6 as "http6"; drop the number. + PROTO=$(echo $2 | sed -e 's/\([[a-zA-Z]]*\).*/\1/') + OVS_WAIT_UNTIL([NS_EXEC([$1], [netstat -l | grep $PROTO])]) ] ) diff --git a/tests/system-traffic.at b/tests/system-traffic.at index 67e06a11805b..803b00850511 100644 --- a/tests/system-traffic.at +++ b/tests/system-traffic.at @@ -1642,7 +1642,6 @@ AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows1.txt]) OVS_START_L7([at_ns0], [ftp]) OVS_START_L7([at_ns1], [ftp]) -OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) dnl FTP requests from p1->p0 should fail due to network failure. dnl Try 3 times, in 1 second intervals. @@ -1727,7 +1726,6 @@ dnl "connect: Cannot assign requested address" OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) OVS_START_L7([at_ns1], [ftp]) -OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) dnl FTP requests from p0->p1 should work fine. NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) @@ -2534,7 +2532,6 @@ m4_define([CHECK_FTP_NAT], AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt]) OVS_START_L7([at_ns1], [ftp]) - OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) dnl FTP requests from p0->p1 should work fine. NS_CHECK_EXEC([at_ns0], [wget ftp://10.1.1.2 -4 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d]) @@ -2772,7 +2769,6 @@ dnl "connect: Cannot assign requested address" OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null]) OVS_START_L7([at_ns1], [ftp]) -OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp]) dnl FTP requests from p0->p1 should work fine. NS_CHECK_EXEC([at_ns0], [wget ftp://[[fc00::2]] -6 --no-passive-ftp -t 3 -T 1 --retry-connrefused -v --server-response --no-remove-listing -o wget0.log -d])