summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2018-05-09 20:36:51 -0600
committerChad Smith <chad.smith@canonical.com>2018-05-09 20:36:51 -0600
commit3b712fcea9ca685c5cb761ea19c5126acf8ffaa1 (patch)
treed2f5ae19e00cc26f831bd3e858c5603c41eb4f6d
parentbde30070ec5f20aeb4d48cee8cf6c49b900ee311 (diff)
downloadvyos-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
-rw-r--r--tests/unittests/test_net.py4
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,