From 00a469d9691da6f2371bcc5a97adb020c011b4b4 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 20 Dec 2018 06:12:19 -0800 Subject: [PATCH] GBP: test case hardening against timing races Change-Id: I3b5d369a37233c7bb2113ce31479371c610977ef Signed-off-by: Neale Ranns --- test/test_gbp.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/test/test_gbp.py b/test/test_gbp.py index 9e930242026..2297c49ffa1 100644 --- a/test/test_gbp.py +++ b/test/test_gbp.py @@ -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 -- 2.16.6