diff options
author | Daniel Watkins <daniel.watkins@canonical.com> | 2019-02-26 15:37:36 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-02-26 15:37:36 +0000 |
commit | 1182ad5f9362e1570c622345a3ac996c07eb2eeb (patch) | |
tree | 273ec82d32d08b67ca2b488c0c991093c29dbdd0 /cloudinit/net/tests | |
parent | f278a8a3dbb1e45e8d83491ad24e41812cb77ddb (diff) | |
download | vyos-cloud-init-1182ad5f9362e1570c622345a3ac996c07eb2eeb.tar.gz vyos-cloud-init-1182ad5f9362e1570c622345a3ac996c07eb2eeb.zip |
tests: fix some slow tests and some leaking state
In test_ds_identify, don't mutate otherwise-static test data. When
running tests in a random order, this was causing failures due to
breaking preconditions for other tests.
In tests/helpers, reset logging level in tearDown. Some of the CLI
tests set the level of the root logger in a way that isn't correctly
reset.
For test_poll_imds_re_dhcp_on_timeout and
test_dhcp_discovery_run_in_sandbox_warns_invalid_pid, mock out
time.sleep; this saves ~11 seconds (or ~40% of previous test time!).
Diffstat (limited to 'cloudinit/net/tests')
-rw-r--r-- | cloudinit/net/tests/test_dhcp.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cloudinit/net/tests/test_dhcp.py b/cloudinit/net/tests/test_dhcp.py index 79e8842f..51390249 100644 --- a/cloudinit/net/tests/test_dhcp.py +++ b/cloudinit/net/tests/test_dhcp.py @@ -117,6 +117,7 @@ class TestDHCPDiscoveryClean(CiTestCase): self.assertEqual('eth9', call[0][1]) self.assertIn('/var/tmp/cloud-init/cloud-init-dhcp-', call[0][2]) + @mock.patch('time.sleep', mock.MagicMock()) @mock.patch('cloudinit.net.dhcp.os.kill') @mock.patch('cloudinit.net.dhcp.util.subp') def test_dhcp_discovery_run_in_sandbox_warns_invalid_pid(self, m_subp, |