GBP: test case hardening against timing races 70/16570/2
authorNeale Ranns <nranns@cisco.com>
Thu, 20 Dec 2018 14:12:19 +0000 (06:12 -0800)
committerDave Barach <openvpp@barachs.net>
Thu, 20 Dec 2018 22:47:05 +0000 (22:47 +0000)
Change-Id: I3b5d369a37233c7bb2113ce31479371c610977ef
Signed-off-by: Neale Ranns <nranns@cisco.com>
test/test_gbp.py

index 9e93024..2297c49 100644 (file)
@@ -1444,7 +1444,7 @@ class TestGBP(VppTestCase):
         # lower the inactive threshold so these tests pass in a
         # reasonable amount of time
         #
-        self.vapi.gbp_endpoint_learn_set_inactive_threshold(1)
+        self.vapi.gbp_endpoint_learn_set_inactive_threshold(2)
 
         #
         # IP tables
@@ -1839,7 +1839,7 @@ class TestGBP(VppTestCase):
         # lower the inactive threshold so these tests pass in a
         # reasonable amount of time
         #
-        self.vapi.gbp_endpoint_learn_set_inactive_threshold(1)
+        self.vapi.gbp_endpoint_learn_set_inactive_threshold(2)
 
         #
         # IP tables
@@ -2014,7 +2014,7 @@ class TestGBP(VppTestCase):
         # lower the inactive threshold so these tests pass in a
         # reasonable amount of time
         #
-        self.vapi.gbp_endpoint_learn_set_inactive_threshold(1)
+        self.vapi.gbp_endpoint_learn_set_inactive_threshold(2)
 
         #
         # IP tables
@@ -2384,30 +2384,29 @@ class TestGBP(VppTestCase):
         rep_88.remove_vpp_config()
         rep_2.remove_vpp_config()
 
-        self.logger.info(self.vapi.cli("show gbp endpoint"))
-
-        self.assertFalse(find_gbp_endpoint(self, ip=rep_88.ip4.address))
+        self.assertTrue(find_gbp_endpoint(self, ip=rep_2.ip4.address))
 
         p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
-             IP(src=ep.ip4.address, dst=rep_88.ip4.address) /
+             IP(src=ep.ip4.address, dst=rep_2.ip4.address) /
              UDP(sport=1234, dport=1234) /
              Raw('\xa5' * 100))
-        rxs = self.send_and_expect(self.pg0, [p], self.pg4)
+        rxs = self.send_and_expect(self.pg0, [p], self.pg2)
 
-        self.assertTrue(find_gbp_endpoint(self, ip=rep_2.ip4.address))
+        self.assertFalse(find_gbp_endpoint(self, ip=rep_88.ip4.address))
 
         p = (Ether(src=ep.mac, dst=self.loop0.local_mac) /
-             IP(src=ep.ip4.address, dst=rep_2.ip4.address) /
+             IP(src=ep.ip4.address, dst=rep_88.ip4.address) /
              UDP(sport=1234, dport=1234) /
              Raw('\xa5' * 100))
-        rxs = self.send_and_expect(self.pg0, [p], self.pg2)
+        rxs = self.send_and_expect(self.pg0, [p], self.pg4)
 
         #
         # to appease the testcase we cannot have the registered EP stll
         # present (because it's DP learnt) when the TC ends so wait until
         # it is removed
         #
-        self.sleep(2)
+        self.wait_for_ep_timeout(ip=rep_88.ip4.address)
+        self.wait_for_ep_timeout(ip=rep_2.ip4.address)
 
         #
         # shutdown with learnt endpoint present
@@ -2458,7 +2457,7 @@ class TestGBP(VppTestCase):
         # lower the inactive threshold so these tests pass in a
         # reasonable amount of time
         #
-        self.vapi.gbp_endpoint_learn_set_inactive_threshold(1)
+        self.vapi.gbp_endpoint_learn_set_inactive_threshold(2)
 
         #
         # IP tables