From: Neale Ranns Date: Fri, 25 Jan 2019 14:37:15 +0000 (-0800) Subject: DHCP-test: more robust sleep check X-Git-Tag: v19.04-rc1~561 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=f6e9b014cbd0ba5a757565a6a0179065d7236463;p=vpp.git DHCP-test: more robust sleep check Change-Id: I48c382797239dc305e01cc35124140d6ce16149a Signed-off-by: Neale Ranns --- diff --git a/test/test_dhcp.py b/test/test_dhcp.py index 833ee00a529..d1af9fd9e7d 100644 --- a/test/test_dhcp.py +++ b/test/test_dhcp.py @@ -360,6 +360,16 @@ class TestDHCP(VppTestCase): # not sure why this is not decoding # adv = pkt[DHCP6_Advertise] + def wait_for_no_route(self, address, length, + n_tries=50, s_time=1): + while (n_tries): + if not find_route(self, address, length): + return True + n_tries = n_tries - 1 + self.sleep(s_time) + + return False + def test_dhcp_proxy(self): """ DHCPv4 Proxy """ @@ -1535,15 +1545,10 @@ class TestDHCP(VppTestCase): is_add=0) # - # Sleep for the lease time - # - self.sleep(lease_time+1) - + # the route should be gone after the lease expires # - # And now the route should be gone - # - self.assertFalse(find_route(self, self.pg3.local_ip4, 32)) - self.assertFalse(find_route(self, self.pg3.local_ip4, 24)) + self.assertTrue(self.wait_for_no_route(self.pg3.local_ip4, 32)) + self.assertTrue(self.wait_for_no_route(self.pg3.local_ip4, 24)) # # remove the DHCP config