← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:networking into cloud-init:master

 

Nice clean-up.  One question inline around the mock used, otherwise fine.

Diff comments:

> diff --git a/cloudinit/sources/tests/test_oracle.py b/cloudinit/sources/tests/test_oracle.py
> index 97d6294..282382c 100644
> --- a/cloudinit/sources/tests/test_oracle.py
> +++ b/cloudinit/sources/tests/test_oracle.py
> @@ -145,15 +145,15 @@ class TestDataSourceOracle(test_helpers.CiTestCase):
>                      MD_VER: {'system_uuid': self.my_uuid,
>                               'meta_data': self.my_md}}}})
>          ncfg = {'version': 1, 'config': [{'a': 'b'}]}
> -        m_cmdline_config.return_value = ncfg
> +        m_initramfs_config.return_value = ncfg
>          self.assertTrue(ds._get_data())
>          self.assertEqual(ncfg, ds.network_config)
> -        m_cmdline_config.assert_called_once_with()
> +        self.assertEqual([mock.call()], m_initramfs_config.call_args_list)

We just need to assert that it was called?
self.assertEqual(1, m_initramfs_config.call_count)

Do we care about the parameters?

>          self.assertFalse(distro.generate_fallback_config.called)
>  
> -    @mock.patch(DS_PATH + ".cmdline.read_kernel_cmdline_config")
> +    @mock.patch(DS_PATH + ".cmdline.read_initramfs_config")
>      @mock.patch(DS_PATH + "._is_iscsi_root", return_value=True)
> -    def test_network_fallback(self, m_is_iscsi_root, m_cmdline_config):
> +    def test_network_fallback(self, m_is_iscsi_root, m_initramfs_config):
>          """test that fallback network is generated if no kernel cmdline."""
>          distro = mock.MagicMock()
>          ds, _ = self._get_ds(distro=distro, patches={


-- 
https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/370526
Your team cloud-init commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:networking into cloud-init:master.


References