def test_ceph_changed_missing_relation_data(self, configs): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = [] configs.write = MagicMock() relations.ceph_changed() self.juju_log.assert_called_with( 'ceph relation incomplete. Peer not ready?')
def test_ceph_changed_no_keyring(self, configs): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['ceph'] configs.write = MagicMock() self.ensure_ceph_keyring.return_value = False relations.ceph_changed() self.juju_log.assert_called_with( 'Could not create ceph keyring: peer not ready?')
def test_ceph_changed_missing_relation_data(self, configs): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = [] configs.write = MagicMock() relations.ceph_changed() self.juju_log.assert_called_with( 'ceph relation incomplete. Peer not ready?' )
def test_ceph_changed_no_keyring(self, configs): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['ceph'] configs.write = MagicMock() self.ensure_ceph_keyring.return_value = False relations.ceph_changed() self.juju_log.assert_called_with( 'Could not create ceph keyring: peer not ready?' )
def test_ceph_changed_with_key_and_relation_data(self, configs): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['ceph'] configs.write = MagicMock() self.ensure_ceph_keyring.return_value = True relations.ceph_changed() self.assertEquals([call('/etc/glance/glance-api.conf'), call('/etc/ceph/ceph.conf')], configs.write.call_args_list) self.ensure_ceph_pool.assert_called_with(service=self.service_name(), replicas=2)
def test_ceph_changed_key_and_relation_data(self, configs, mock_request_complete, mock_send_request_if_needed, mock_service): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['ceph'] configs.write = MagicMock() self.ensure_ceph_keyring.return_value = True mock_request_complete.return_value = True self.ceph_config_file.return_value = '/etc/ceph/ceph.conf' relations.ceph_changed() self.assertEqual( [call('/etc/glance/glance-api.conf'), call('/etc/ceph/ceph.conf')], configs.write.call_args_list) self.service_restart.assert_called_with('glance-api')
def test_ceph_changed_key_and_relation_data(self, configs, mock_request_complete, mock_send_request_if_needed, mock_service): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['ceph'] configs.write = MagicMock() self.ensure_ceph_keyring.return_value = True mock_request_complete.return_value = True self.ceph_config_file.return_value = '/etc/ceph/ceph.conf' relations.ceph_changed() self.assertEqual([call('/etc/glance/glance-api.conf'), call('/etc/ceph/ceph.conf')], configs.write.call_args_list) self.service_restart.assert_called_with('glance-api')