[corey.bryant,trivial] Add test for action-managed upgrade path in config-changed

This commit is contained in:
Corey Bryant 2015-09-29 21:04:16 +00:00
parent 2a5e9c37e7
commit b321fd7b91
2 changed files with 14 additions and 2 deletions

View File

@ -24,12 +24,13 @@ class TestNeutronAPIUpgradeActions(CharmTestCase):
super(TestNeutronAPIUpgradeActions, self).setUp(openstack_upgrade,
TO_PATCH)
@patch('charmhelpers.contrib.openstack.utils.juju_log')
@patch('charmhelpers.contrib.openstack.utils.config')
@patch('charmhelpers.contrib.openstack.utils.action_set')
@patch('charmhelpers.contrib.openstack.utils.git_install_requested')
@patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
def test_openstack_upgrade_true(self, upgrade_avail, git_requested,
action_set, config):
action_set, config, log):
git_requested.return_value = False
upgrade_avail.return_value = True
config.return_value = True
@ -39,12 +40,13 @@ class TestNeutronAPIUpgradeActions(CharmTestCase):
self.assertTrue(self.do_openstack_upgrade.called)
self.assertTrue(self.config_changed.called)
@patch('charmhelpers.contrib.openstack.utils.juju_log')
@patch('charmhelpers.contrib.openstack.utils.config')
@patch('charmhelpers.contrib.openstack.utils.action_set')
@patch('charmhelpers.contrib.openstack.utils.git_install_requested')
@patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
def test_openstack_upgrade_false(self, upgrade_avail, git_requested,
action_set, config):
action_set, config, log):
git_requested.return_value = False
upgrade_avail.return_value = True
config.return_value = False

View File

@ -244,6 +244,16 @@ class NeutronAPIHooksTests(CharmTestCase):
self.assertTrue(_zmq_joined.called)
self.assertTrue(_id_cluster_joined.called)
@patch.object(hooks, 'git_install_requested')
def test_config_changed_with_openstack_upgrade_action(self, git_requested):
git_requested.return_value = False
self.openstack_upgrade_available.return_value = True
self.test_config.set('action-managed-upgrade', True)
self._call_hook('config-changed')
self.assertFalse(self.do_openstack_upgrade.called)
def test_amqp_joined(self):
self._call_hook('amqp-relation-joined')
self.relation_set.assert_called_with(