bbaaef
From 65d601cd755051fcf38b707b1283e29152aa0dcb Mon Sep 17 00:00:00 2001
bbaaef
From: Numan Siddique <numans@ovn.org>
bbaaef
Date: Mon, 11 Nov 2019 12:26:40 +0530
bbaaef
Subject: [PATCH] Fix testsuite 85 - "ensure one gw controller restart in HA
bbaaef
 doesn't bounce the master ok".
bbaaef
bbaaef
This testsuite is failing frequently in travis CI and locally when tests are run with "-j5".
bbaaef
bbaaef
The test case deletes the chassis row for chassis 'gw2' and expects that this
bbaaef
doesn't cause the chassisresident port on the master ('gw1') to not bounce as 'gw1'
bbaaef
has higher priority than gw2. But since the ha chassis group has only 2 chassis,
bbaaef
'gw2' can claim the port momentarily when 'gw2' chassis row is recreated until
bbaaef
BFD session with 'gw1' is not established.
bbaaef
bbaaef
This patch changes the test assertion approach and makes sure that 'gw1' is the
bbaaef
owner of the chassisresident port eventually.
bbaaef
bbaaef
Acked-by: Dumitru Ceara <dceara@redhat.com>
bbaaef
Tested-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
bbaaef
Signed-off-by: Numan Siddique <numans@ovn.org>
bbaaef
---
bbaaef
 tests/ovn.at | 20 +++++++++++++++++---
bbaaef
 1 file changed, 17 insertions(+), 3 deletions(-)
bbaaef
bbaaef
diff --git a/tests/ovn.at b/tests/ovn.at
bbaaef
index 3e429e347..5fc2de2d3 100644
bbaaef
--- a/tests/ovn.at
bbaaef
+++ b/tests/ovn.at
bbaaef
@@ -11033,12 +11033,26 @@ ovn-nbctl --wait=hv --timeout=3 sync
bbaaef
 # doesn't have the same effect because "name" is conserved, and the
bbaaef
 # Chassis entry is not replaced.
bbaaef
 
bbaaef
-> gw1/ovn-controller.log
bbaaef
-
bbaaef
 gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)
bbaaef
 ovn-sbctl destroy Chassis $gw2_chassis
bbaaef
 
bbaaef
-OVS_WAIT_UNTIL([test 0 = `grep -c "Releasing lport" gw1/ovn-controller.log`])
bbaaef
+# Wait for the gw2_chassis row is recreated.
bbaaef
+OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns=_uuid find Chassis name=gw2 | wc -l`])
bbaaef
+
bbaaef
+gw1_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw1)
bbaaef
+gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)
bbaaef
+
bbaaef
+# When gw2 chassis row is destroyed, it gets recreated. There
bbaaef
+# is a small window in which gw2 may claim the cr-outside port if
bbaaef
+# it has not established bfd tunnel with gw1.
bbaaef
+# So make sure that, cr-outside is claimed by gw1 finally.
bbaaef
+OVS_WAIT_WHILE(
bbaaef
+    [cr_outside_ch=`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside`
bbaaef
+     test $cr_outside_ch = $gw2_chassis])
bbaaef
+
bbaaef
+OVS_WAIT_UNTIL(
bbaaef
+    [cr_outside_ch=`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside`
bbaaef
+     test $cr_outside_ch = $gw1_chassis])
bbaaef
 
bbaaef
 OVN_CLEANUP([gw1],[gw2],[hv1])
bbaaef
 
bbaaef
-- 
bbaaef
2.23.0
bbaaef