Fix unit tests

This commit is contained in:
Liam Young 2015-01-22 16:51:07 +00:00
parent c5224d8e10
commit 6bb29ed23f
2 changed files with 8 additions and 3 deletions

View File

@ -132,7 +132,7 @@ def config_changed():
cluster_joined(relation_id=rid) cluster_joined(relation_id=rid)
for r_id in relation_ids('ha'): for r_id in relation_ids('ha'):
ha_joined(relation_id=r_id) ha_joined(relation_id=r_id)
@hooks.hook('shared-db-relation-joined') @hooks.hook('shared-db-relation-joined')
def db_joined(): def db_joined():

View File

@ -136,6 +136,7 @@ class TestClusterHooks(CharmTestCase):
'res_cinder_haproxy': 'op monitor interval="5s"' 'res_cinder_haproxy': 'op monitor interval="5s"'
}, },
'corosync_bindiface': 'eth100', 'corosync_bindiface': 'eth100',
'relation_id': None,
'clones': {'cl_cinder_haproxy': 'res_cinder_haproxy'}, 'clones': {'cl_cinder_haproxy': 'res_cinder_haproxy'},
'resources': { 'resources': {
'res_cinder_eth101_vip': 'ocf:heartbeat:IPaddr2', 'res_cinder_eth101_vip': 'ocf:heartbeat:IPaddr2',
@ -143,7 +144,8 @@ class TestClusterHooks(CharmTestCase):
} }
} }
self.relation_set.assert_has_calls([ self.relation_set.assert_has_calls([
call(groups={'grp_cinder_vips': 'res_cinder_eth101_vip'}), call(relation_id=None,
groups={'grp_cinder_vips': 'res_cinder_eth101_vip'}),
call(**ex_args) call(**ex_args)
]) ])
@ -163,6 +165,7 @@ class TestClusterHooks(CharmTestCase):
self.get_netmask_for_address.return_value = 'ffff.ffff.ffff.ffff' self.get_netmask_for_address.return_value = 'ffff.ffff.ffff.ffff'
hooks.hooks.execute(['hooks/ha-relation-joined']) hooks.hooks.execute(['hooks/ha-relation-joined'])
ex_args = { ex_args = {
'relation_id': None,
'corosync_mcastport': '37373', 'corosync_mcastport': '37373',
'init_services': {'res_cinder_haproxy': 'haproxy'}, 'init_services': {'res_cinder_haproxy': 'haproxy'},
'resource_params': { 'resource_params': {
@ -200,6 +203,7 @@ class TestClusterHooks(CharmTestCase):
self.get_netmask_for_address.return_value = None self.get_netmask_for_address.return_value = None
hooks.hooks.execute(['hooks/ha-relation-joined']) hooks.hooks.execute(['hooks/ha-relation-joined'])
ex_args = { ex_args = {
'relation_id': None,
'corosync_mcastport': '37373', 'corosync_mcastport': '37373',
'init_services': {'res_cinder_haproxy': 'haproxy'}, 'init_services': {'res_cinder_haproxy': 'haproxy'},
'resource_params': { 'resource_params': {
@ -216,7 +220,8 @@ class TestClusterHooks(CharmTestCase):
} }
} }
self.relation_set.assert_has_calls([ self.relation_set.assert_has_calls([
call(groups={'grp_cinder_vips': 'res_cinder_eth120_vip'}), call(relation_id=None,
groups={'grp_cinder_vips': 'res_cinder_eth120_vip'}),
call(**ex_args) call(**ex_args)
]) ])