From ffd0897626bd9ac48d29221b4f647bd7c0b15792 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 23 Jul 2019 11:54:28 +0200 Subject: nm.py autopkgtest: Improved check_connected_device_config() - Replaced hard sleep() by longer timeout on check for config data available - While config data still not available get_ip{4|6}_config() not None but empty, checking appropriately now --- debian/tests/nm.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'debian') diff --git a/debian/tests/nm.py b/debian/tests/nm.py index d9b58b70..c79dcb82 100755 --- a/debian/tests/nm.py +++ b/debian/tests/nm.py @@ -346,10 +346,10 @@ class NetworkManagerTest(network_test_base.NetworkTestBase): def check_connected_device_config(self, ipv6_mode, nmdev): '''Check NMDevice configuration state after being connected''' - time.sleep(10) if ipv6_mode is not None: - # FIXME: why do we need to wait here, if state is already ACTIVATED? - self.assertEventually(lambda: nmdev.get_ip6_config() is not None, timeout=50) + # Wait for a valid, non-empty config entry (Why wait here, + # connection is already ACTIVATED?) + self.assertEventually(lambda: ((nmdev.get_ip6_config() is not None) and (len(nmdev.get_ip6_config().get_addresses()) > 0)), timeout=600) #self.assertEqual(nmdev.get_ip4_config(), None) conf = nmdev.get_ip6_config() self.assertNotEqual(conf, None) @@ -360,8 +360,9 @@ class NetworkManagerTest(network_test_base.NetworkTestBase): # note, we cannot call IP6Address.get_address(), as that returns a # raw gpointer; check address with low-level tools only else: - # FIXME: why do we need to wait here, if state is already ACTIVATED? - self.assertEventually(lambda: nmdev.get_ip4_config() is not None, timeout=50) + # Wait for a valid, non-empty config entry (Why wait here, + # connection is already ACTIVATED?) + self.assertEventually(lambda: ((nmdev.get_ip4_config() is not None) and (len(nmdev.get_ip4_config().get_addresses()) > 0)), timeout=600) conf = nmdev.get_ip4_config() self.assertNotEqual(conf, None) self.assertEqual(len(conf.get_addresses()), 1) -- cgit 1.3.0-6-gf8a5