diff options
author | Lars Kellogg-Stedman <lars@redhat.com> | 2018-05-09 20:36:51 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-05-09 20:36:51 -0600 |
commit | 3b712fcea9ca685c5cb761ea19c5126acf8ffaa1 (patch) | |
tree | d2f5ae19e00cc26f831bd3e858c5603c41eb4f6d /tests/unittests/test_net.py | |
parent | bde30070ec5f20aeb4d48cee8cf6c49b900ee311 (diff) | |
download | vyos-cloud-init-3b712fcea9ca685c5cb761ea19c5126acf8ffaa1.tar.gz vyos-cloud-init-3b712fcea9ca685c5cb761ea19c5126acf8ffaa1.zip |
tests: do not rely on host /proc/cmdline in test_net.py
Make test_net.TestGenerateFallbackConfig.test_unstable_names mock
the value of /proc/cmdline in the same way as the existing
test_unstable_names_disabled test.
LP: #1769952
Diffstat (limited to 'tests/unittests/test_net.py')
-rw-r--r-- | tests/unittests/test_net.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py index 31807e13..e13ca3ce 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -1605,12 +1605,13 @@ iface eth1 inet dhcp ] self.assertEqual(", ".join(expected_rule) + '\n', contents.lstrip()) + @mock.patch("cloudinit.util.get_cmdline") @mock.patch("cloudinit.util.udevadm_settle") @mock.patch("cloudinit.net.sys_dev_path") @mock.patch("cloudinit.net.read_sys_net") @mock.patch("cloudinit.net.get_devicelist") def test_unstable_names(self, mock_get_devicelist, mock_read_sys_net, - mock_sys_dev_path, mock_settle): + mock_sys_dev_path, mock_settle, m_get_cmdline): """verify that udevadm settle is called when we find unstable names""" devices = { 'eth0': { @@ -1626,6 +1627,7 @@ iface eth1 inet dhcp } + m_get_cmdline.return_value = '' tmp_dir = self.tmp_dir() _setup_test(tmp_dir, mock_get_devicelist, mock_read_sys_net, mock_sys_dev_path, |