[trivial] Fixup failing LXD unit tests, refactor invalid assert calls
This commit is contained in:
parent
86ad8ea978
commit
391e84e6c4
|
@ -82,7 +82,7 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
self.configure_installation_source.assert_called_with(repo)
|
||||
self.assertTrue(self.apt_update.called)
|
||||
self.apt_install.assert_called_with(['foo', 'bar'], fatal=True)
|
||||
self.execd_preinstall.assert_called()
|
||||
self.assertTrue(self.execd_preinstall.called)
|
||||
|
||||
def test_install_hook_git(self):
|
||||
self.git_install_requested.return_value = True
|
||||
|
@ -107,7 +107,7 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
self.assertTrue(self.apt_update.called)
|
||||
self.apt_install.assert_called_with(['foo', 'bar'], fatal=True)
|
||||
self.git_install.assert_called_with(projects_yaml)
|
||||
self.execd_preinstall.assert_called()
|
||||
self.assertTrue(self.execd_preinstall.called)
|
||||
|
||||
def test_config_changed_with_upgrade(self):
|
||||
self.git_install_requested.return_value = False
|
||||
|
@ -185,7 +185,7 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
self.git_install_requested.return_value = False
|
||||
self.test_config.set('sysctl', '{ kernel.max_pid : "1337" }')
|
||||
hooks.config_changed()
|
||||
self.create_sysctl.assert_called()
|
||||
self.assertTrue(self.create_sysctl.called)
|
||||
|
||||
@patch.object(hooks, 'config_value_changed')
|
||||
def test_config_changed_git(self, config_val_changed):
|
||||
|
@ -226,7 +226,7 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
self.migration_enabled.return_value = False
|
||||
self.is_relation_made.return_value = True
|
||||
hooks.config_changed()
|
||||
self.update_nrpe_config.assert_called_once()
|
||||
self.assertTrue(self.update_nrpe_config.called)
|
||||
|
||||
def test_amqp_joined(self):
|
||||
hooks.amqp_joined()
|
||||
|
@ -369,7 +369,6 @@ class NovaComputeRelationsTests(CharmTestCase):
|
|||
def test_compute_joined_no_migration_no_resize(self):
|
||||
self.migration_enabled.return_value = False
|
||||
hooks.compute_joined()
|
||||
self.relation_set.assertCalledWith(hostname='arm')
|
||||
self.assertFalse(self.relation_set.called)
|
||||
|
||||
def test_compute_joined_with_ssh_migration(self):
|
||||
|
|
|
@ -463,16 +463,22 @@ class NovaComputeUtilsTests(CharmTestCase):
|
|||
compute_context.CEPH_SECRET_UUID,
|
||||
'--base64', key])
|
||||
|
||||
@patch.object(utils, 'lxc_list')
|
||||
@patch.object(utils, 'configure_subuid')
|
||||
def test_configure_lxd_vivid(self, _configure_subuid):
|
||||
def test_configure_lxd_vivid(self, _configure_subuid, _lxc_list):
|
||||
self.lsb_release.return_value = {
|
||||
'DISTRIB_CODENAME': 'vivid'
|
||||
}
|
||||
utils.configure_lxd('nova')
|
||||
_configure_subuid.assert_called_with(user='nova')
|
||||
_configure_subuid.assert_called_with('nova')
|
||||
_lxc_list.assert_called_with('nova')
|
||||
|
||||
@patch.object(utils, 'git_install_requested')
|
||||
@patch.object(utils, 'lxc_list')
|
||||
@patch.object(utils, 'configure_subuid')
|
||||
def test_configure_lxd_pre_vivid(self, _configure_subuid):
|
||||
def test_configure_lxd_pre_vivid(self, _configure_subuid, _lxc_list,
|
||||
_git_install):
|
||||
_git_install.return_value = False
|
||||
self.lsb_release.return_value = {
|
||||
'DISTRIB_CODENAME': 'trusty'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue