~hopem/charms/trusty/keystone/charm-helpers-sync-precise-ipv6-haproxy

« back to all changes in this revision

Viewing changes to unit_tests/test_keystone_hooks.py

  • Committer: Liam Young
  • Date: 2014-07-29 08:05:41 UTC
  • mfrom: (68.2.24 keystone)
  • Revision ID: liam.young@canonical.com-20140729080541-8twej4w7c1sv1vka
[jamespage,r=gnuoy] Add support for multiple network configuration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    # charmhelpers.contrib.openstack.utils
42
42
    'configure_installation_source',
43
43
    # charmhelpers.contrib.hahelpers.cluster_utils
 
44
    'is_leader',
44
45
    'eligible_leader',
 
46
    'get_hacluster_config',
45
47
    # keystone_utils
46
48
    'restart_map',
47
49
    'register_configs',
52
54
    'ensure_initial_admin',
53
55
    'add_service_to_keystone',
54
56
    'synchronize_ca',
55
 
    'get_hacluster_config',
56
 
    'is_leader',
57
57
    # other
58
58
    'check_call',
59
59
    'execd_preinstall',
60
60
    'mkdir',
61
61
    'os',
62
62
    'time',
 
63
    # ip
 
64
    'get_iface_for_address',
 
65
    'get_netmask_for_address',
63
66
]
64
67
 
65
68
 
299
302
 
300
303
    def test_ha_joined(self):
301
304
        self.get_hacluster_config.return_value = {
 
305
            'vip': '10.10.10.10',
302
306
            'ha-bindiface': 'em0',
303
 
            'ha-mcastport': '8080',
304
 
            'vip': '10.10.10.10',
305
 
            'vip_iface': 'em1',
306
 
            'vip_cidr': '24'
 
307
            'ha-mcastport': '8080'
307
308
        }
 
309
        self.get_iface_for_address.return_value = 'em1'
 
310
        self.get_netmask_for_address.return_value = '255.255.255.0'
308
311
        hooks.ha_joined()
309
 
        self.assertTrue(self.get_hacluster_config.called)
310
312
        args = {
311
313
            'corosync_bindiface': 'em0',
312
314
            'corosync_mcastport': '8080',
313
315
            'init_services': {'res_ks_haproxy': 'haproxy'},
314
 
            'resources': {'res_ks_vip': 'ocf:heartbeat:IPaddr2',
 
316
            'resources': {'res_ks_em1_vip': 'ocf:heartbeat:IPaddr2',
315
317
                          'res_ks_haproxy': 'lsb:haproxy'},
316
318
            'resource_params': {
317
 
                'res_ks_vip': 'params ip="10.10.10.10"'
318
 
                              ' cidr_netmask="24" nic="em1"',
 
319
                'res_ks_em1_vip': 'params ip="10.10.10.10"'
 
320
                                  ' cidr_netmask="255.255.255.0" nic="em1"',
319
321
                'res_ks_haproxy': 'op monitor interval="5s"'},
320
322
            'clones': {'cl_ks_haproxy': 'res_ks_haproxy'}
321
323
        }