Esempio n. 1
0
 def test_master_relation_joined_create_everything(self):
     for k, v in self._complete_config.items():
         self.test_config.set(k, v)
     self.listen_port.return_value = 80
     self.is_leader.return_value = True
     self.leader_get.side_effect = lambda attr: self._leader_data.get(attr)
     self.multisite.list_realms.return_value = []
     self.multisite.list_zonegroups.return_value = []
     self.multisite.list_zones.return_value = []
     self.multisite.list_users.return_value = []
     self.multisite.create_system_user.return_value = (
         'mykey', 'mysecret',
     )
     ceph_hooks.master_relation_joined('master:1')
     self.config.assert_has_calls([
         call('realm'),
         call('zonegroup'),
         call('zone'),
     ])
     self.multisite.create_realm.assert_called_once_with(
         'testrealm',
         default=True,
     )
     self.multisite.create_zonegroup.assert_called_once_with(
         'testzonegroup',
         endpoints=['http://*****:*****@hostname')
     self.leader_set.assert_has_calls([
         call(access_key='mykey',
              secret='mysecret'),
         call(restart_nonce=ANY),
     ])
     self.relation_set.assert_called_with(
         relation_id='master:1',
         access_key='mykey',
         secret='mysecret',
     )
Esempio n. 2
0
 def test_master_relation_joined_create_everything(self):
     for k, v in self._complete_config.items():
         self.test_config.set(k, v)
     self.is_leader.return_value = True
     self.leader_get.side_effect = lambda attr: self._leader_data.get(attr)
     self.multisite.list_realms.return_value = []
     self.multisite.list_zonegroups.return_value = []
     self.multisite.list_zones.return_value = []
     self.multisite.list_users.return_value = []
     self.multisite.create_system_user.return_value = (
         'mykey', 'mysecret',
     )
     ceph_hooks.master_relation_joined('master:1')
     self.config.assert_has_calls([
         call('realm'),
         call('zonegroup'),
         call('zone'),
     ])
     self.multisite.create_realm.assert_called_once_with(
         'testrealm',
         default=True,
     )
     self.multisite.create_zonegroup.assert_called_once_with(
         'testzonegroup',
         endpoints=['http://*****:*****@hostname')
     self.leader_set.assert_has_calls([
         call(access_key='mykey',
              secret='mysecret'),
         call(restart_nonce=ANY),
     ])
     self.relation_set.assert_called_with(
         relation_id='master:1',
         access_key='mykey',
         secret='mysecret',
     )
Esempio n. 3
0
 def test_master_relation_joined_missing_config(self):
     ceph_hooks.master_relation_joined('master:1')
     self.config.assert_has_calls([
         call('realm'),
         call('zonegroup'),
         call('zone'),
     ])
     self.relation_set.assert_not_called()
Esempio n. 4
0
 def test_master_relation_joined_missing_config(self):
     ceph_hooks.master_relation_joined('master:1')
     self.config.assert_has_calls([
         call('realm'),
         call('zonegroup'),
         call('zone'),
     ])
     self.relation_set.assert_not_called()
Esempio n. 5
0
 def test_master_relation_joined_not_leader(self):
     for k, v in self._complete_config.items():
         self.test_config.set(k, v)
     self.is_leader.return_value = False
     self.leader_get.side_effect = lambda attr: self._leader_data.get(attr)
     ceph_hooks.master_relation_joined('master:1')
     self.relation_set.assert_called_once_with(
         relation_id='master:1',
         realm='testrealm',
         zonegroup='testzonegroup',
         url='http://rgw:80',
         access_key='mykey',
         secret='mysecret',
     )
     self.multisite.list_realms.assert_not_called()
Esempio n. 6
0
 def test_master_relation_joined_not_leader(self):
     for k, v in self._complete_config.items():
         self.test_config.set(k, v)
     self.listen_port.return_value = 80
     self.is_leader.return_value = False
     self.leader_get.side_effect = lambda attr: self._leader_data.get(attr)
     ceph_hooks.master_relation_joined('master:1')
     self.relation_set.assert_called_once_with(
         relation_id='master:1',
         realm='testrealm',
         zonegroup='testzonegroup',
         url='http://rgw:80',
         access_key='mykey',
         secret='mysecret',
     )
     self.multisite.list_realms.assert_not_called()
Esempio n. 7
0
 def test_master_relation_joined_create_nothing(self):
     for k, v in self._complete_config.items():
         self.test_config.set(k, v)
     self.is_leader.return_value = True
     self.leader_get.side_effect = (
         lambda attr: self._leader_data_done.get(attr))
     self.multisite.list_realms.return_value = ['testrealm']
     self.multisite.list_zonegroups.return_value = ['testzonegroup']
     self.multisite.list_zones.return_value = ['testzone']
     self.multisite.list_users.return_value = [
         ceph_hooks.MULTISITE_SYSTEM_USER
     ]
     ceph_hooks.master_relation_joined('master:1')
     self.multisite.create_realm.assert_not_called()
     self.multisite.create_zonegroup.assert_not_called()
     self.multisite.create_zone.assert_not_called()
     self.multisite.create_system_user.assert_not_called()
     self.multisite.update_period.assert_not_called()
     self.service_restart.assert_not_called()
     self.leader_set.assert_not_called()
Esempio n. 8
0
 def test_master_relation_joined_create_nothing(self):
     for k, v in self._complete_config.items():
         self.test_config.set(k, v)
     self.is_leader.return_value = True
     self.leader_get.side_effect = (
         lambda attr: self._leader_data_done.get(attr)
     )
     self.multisite.list_realms.return_value = ['testrealm']
     self.multisite.list_zonegroups.return_value = ['testzonegroup']
     self.multisite.list_zones.return_value = ['testzone']
     self.multisite.list_users.return_value = [
         ceph_hooks.MULTISITE_SYSTEM_USER
     ]
     ceph_hooks.master_relation_joined('master:1')
     self.multisite.create_realm.assert_not_called()
     self.multisite.create_zonegroup.assert_not_called()
     self.multisite.create_zone.assert_not_called()
     self.multisite.create_system_user.assert_not_called()
     self.multisite.update_period.assert_not_called()
     self.service_restart.assert_not_called()
     self.leader_set.assert_not_called()