Add zuul and gitreview

Fix unit tests too.

Change-Id: I1f56d5c5b064b631f0b41a88cc8c30e32863f9ab
This commit is contained in:
Liam Young 2020-09-01 10:32:00 +00:00
parent cc10f29d46
commit ac981cb0ba
3 changed files with 15 additions and 5 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.opendev.org
port=29418
project=openstack/charm-ops-interface-ceph-client.git

4
.zuul.yaml Normal file
View File

@ -0,0 +1,4 @@
- project:
templates:
- openstack-python3-charm-jobs
- openstack-cover-jobs

View File

@ -18,12 +18,14 @@ import copy
import unittest
import json
from unittest import mock
from mock import patch, Mock
from ops import framework
from ops.charm import CharmBase
from ops.testing import Harness
with patch('charmhelpers.core.host_factory.ubuntu.cmp_pkgrevno',
Mock(return_value=1)):
from charmhelpers.contrib.storage.linux.ceph import CephBrokerRq
from interface_ceph_client.ceph_client import (
@ -254,7 +256,7 @@ class TestCephClientRequires(unittest.TestCase):
'ceph-client')
receiver = TestReceiver(self.harness.framework, 'receiver')
self.harness.framework.observe(self.ceph_client.on.broker_available,
receiver)
receiver.on_broker_available)
# No data yet.
relation_id = self.harness.add_relation('ceph-client', 'ceph-mon')
# Get broker_available as soon as relation is present.
@ -278,7 +280,7 @@ class TestCephClientRequires(unittest.TestCase):
self.assertIsInstance(receiver.observed_events[0],
BrokerAvailableEvent)
@mock.patch.object(CephClientRequires, 'send_request_if_needed')
@patch.object(CephClientRequires, 'send_request_if_needed')
def test_create_replicated_pool(self, _send_request_if_needed):
# TODO: Replace mocking with real calls. Otherwise this test is not
# very useful.
@ -293,7 +295,7 @@ class TestCephClientRequires(unittest.TestCase):
self.ceph_client.create_replicated_pool('ceph-client')
_send_request_if_needed.assert_called()
@mock.patch.object(CephClientRequires, 'send_request_if_needed')
@patch.object(CephClientRequires, 'send_request_if_needed')
def test_create_request_ceph_permissions(self, _send_request_if_needed):
# TODO: Replace mocking with real calls. Otherwise this test is not
# very useful.