12
12
utils.service_enabled = MagicMock()
14
14
import cinder_hooks as hooks
15
hooks.hooks._config_save = False
16
17
# Unpatch it now that its loaded.
17
18
utils.register_configs = _register_configs
64
65
super(TestClusterHooks, self).setUp(hooks, TO_PATCH)
65
self.config.side_effect = self.test_config.get_all
66
self.config.side_effect = self.test_config.get
67
68
@patch('charmhelpers.core.host.service')
68
69
@patch('charmhelpers.core.host.file_hash')
121
122
'vip_iface': 'eth101',
122
123
'vip_cidr': '19',
126
self.test_config.set('prefer-ipv6', 'False')
124
127
self.get_hacluster_config.return_value = conf
125
128
self.get_iface_for_address.return_value = 'eth101'
126
129
self.get_netmask_for_address.return_value = '255.255.224.0'
152
def test_ha_joined_complete_config_with_ipv6(self):
153
'Ensure hacluster subordinate receives all relevant config'
155
'ha-bindiface': 'eth100',
156
'ha-mcastport': '37373',
157
'vip': '2001:db8:1::1',
158
'vip_iface': 'eth101',
162
self.test_config.set('prefer-ipv6', 'True')
163
self.get_hacluster_config.return_value = conf
164
self.get_iface_for_address.return_value = 'eth101'
165
self.get_netmask_for_address.return_value = 'ffff.ffff.ffff.ffff'
166
hooks.hooks.execute(['hooks/ha-relation-joined'])
168
'corosync_mcastport': '37373',
169
'init_services': {'res_cinder_haproxy': 'haproxy'},
171
'res_cinder_eth101_vip':
172
'params ipv6addr="2001:db8:1::1" '
173
'cidr_netmask="ffff.ffff.ffff.ffff" '
175
'res_cinder_haproxy': 'op monitor interval="5s"'
177
'corosync_bindiface': 'eth100',
178
'clones': {'cl_cinder_haproxy': 'res_cinder_haproxy'},
180
'res_cinder_eth101_vip': 'ocf:heartbeat:IPv6addr',
181
'res_cinder_haproxy': 'lsb:haproxy'
184
self.relation_set.assert_called_with(**ex_args)
149
186
@patch.object(hooks, 'identity_joined')
150
187
def test_ha_changed_clustered(self, joined):
151
188
self.relation_get.return_value = True