← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~larsks/cloud-init:bug/1769952 into cloud-init:master

 

Lars Kellogg-Stedman has proposed merging ~larsks/cloud-init:bug/1769952 into cloud-init:master.

Commit message:
do not rely on host /proc/cmdline in test_net.py
    
this makes test_net.TestGenerateFallbackConfig.test_unstable_names mock the value of /proc/cmdline in the same way as the existing test_unstable_names_disabled test.
    


Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1769952 in cloud-init: "test_net.TestGenerateFallbackConfig.test_unstable_names is sensitive to host environment"
  https://bugs.launchpad.net/cloud-init/+bug/1769952

For more details, see:
https://code.launchpad.net/~larsks/cloud-init/+git/cloud-init/+merge/345248
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~larsks/cloud-init:bug/1769952 into cloud-init:master.
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index fac8267..73f26bb 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -1608,12 +1608,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': {
@@ -1629,6 +1630,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,

Follow ups