From 0de933048d063966bd5f26eee0a3f9d0c3c4b2a3 Mon Sep 17 00:00:00 2001 From: James Page Date: Fri, 13 Jan 2023 16:20:49 +0000 Subject: [PATCH] ci: Add Zuul configuration Add configuration for Zuul checks. Add gitreview configuration. Pick fixes from: Ia13d002aca1bd0c10e7c7a824e74303bddc07d25 to ensure that tests actually pass. Add missing py310 tox target. Fix charm-ops-openstack dependency Fix test bundle deployment Fix string quotation in overlay test bundle Fix j2 templates inclusion in coverage report Co-Authored-By: Nikolay Vinogradov Change-Id: Ia0b7a1fa43b1a689a7554b503d42ccb944e7c45f --- .gitreview | 5 ++++ .zuul.yaml | 4 ++++ requirements.txt | 2 +- src/charm.py | 2 +- tests/bundles/focal-ussuri.yaml | 5 ++-- .../overlays/local-charm-overlay.yaml.j2 | 10 ++++---- tests/tests.py | 24 ++++++++++++------- tox.ini | 6 +++++ 8 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 .gitreview create mode 100644 .zuul.yaml diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..ccbdd17 --- /dev/null +++ b/.gitreview @@ -0,0 +1,5 @@ +[gerrit] +host=review.opendev.org +port=29418 +project=openstack/charm-manila-infinidat.git +defaultbranch=main diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..7ffc71c --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,4 @@ +- project: + templates: + - openstack-python3-charm-yoga-jobs + - openstack-cover-jobs diff --git a/requirements.txt b/requirements.txt index bd51e1a..86315ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ ops -git+https://github.com/nikolayvinogradov/charm-ops-openstack@nickv#egg=ops_openstack +git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack diff --git a/src/charm.py b/src/charm.py index 8efd231..4f287dd 100755 --- a/src/charm.py +++ b/src/charm.py @@ -72,7 +72,7 @@ class ManilaInfinidatPluginCharm(OSBaseCharm): def on_config(self, event): self.on_manila_plugin(event) - self.set_started(started=True) + self._stored.is_started = True if self.framework.model.relations.get(RELATION_NAME): self.send_backend_config() self.unit.status = ActiveStatus('Unit is ready') diff --git a/tests/bundles/focal-ussuri.yaml b/tests/bundles/focal-ussuri.yaml index 45075ad..eee2730 100644 --- a/tests/bundles/focal-ussuri.yaml +++ b/tests/bundles/focal-ussuri.yaml @@ -18,7 +18,7 @@ variables: ovn-channel: &ovn-channel latest/stable openstack-channel: &openstack-channel ussuri/edge mysql-channel: &mysql-channel 8.0/stable - repo-infinidat-apt-key: &repo-infinidat-apt-key > + repo-infinidat-apt-key: &repo-infinidat-apt-key | -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.11 (GNU/Linux) @@ -327,8 +327,7 @@ applications: channel: *openstack-channel options: openstack-origin: *openstack-origin - default-share-backend: 'iscsi' - pool: 'manila' + default-share-backend: 'nas' to: - 'lxd:0' manila-mysql-router: diff --git a/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/bundles/overlays/local-charm-overlay.yaml.j2 index f7b2b7a..537f7b7 100644 --- a/tests/bundles/overlays/local-charm-overlay.yaml.j2 +++ b/tests/bundles/overlays/local-charm-overlay.yaml.j2 @@ -1,9 +1,9 @@ applications: manila-infinidat: options: - infinibox-ip: {{ OS_INFINIBOX_IP }} - infinibox-login: {{ OS_INFINIBOX_LOGIN }} - infinibox-password: {{ OS_INFINIBOX_PASSWORD }} + infinibox-ip: "{{ OS_INFINIBOX_IP }}" + infinibox-login: "{{ OS_INFINIBOX_LOGIN }}" + infinibox-password: "{{ OS_INFINIBOX_PASSWORD }}" # network space of type NAS on the Infinibox side - nas-network-space-name: {{ OS_INFINIBOX_NAS_NETSPACE | default('nas') }} - pool-name: {{ OS_INFINIBOX_POOL_NAME | default('manila') }} + nas-network-space-name: "{{ OS_INFINIBOX_NAS_NETSPACE | default('nas') }}" + pool-name: "{{ OS_INFINIBOX_POOL_NAME | default('manila') }}" diff --git a/tests/tests.py b/tests/tests.py index 2c6e285..c795080 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -17,20 +17,26 @@ """Encapsulate manila-infinidat testing.""" -import zaza.openstack.charm_tests.test_utils as test_utils import zaza.openstack.charm_tests.manila.tests as manila_tests +import zaza.openstack.utilities.openstack as openstack_utils from manilaclient import client as manilaclient + def configure_infinidat_share_type(): + auth = openstack_utils.get_overcloud_auth() + keystone_session = openstack_utils.get_overcloud_keystone_session() + mcl = manilaclient.Client( - session=cls.keystone_session, - client_version='2', - cacert='/var/snap/openstackclients/common/cacert') + session=keystone_session, + client_version='2', + cacert=auth.get('OS_CACERT', None)) share_type = mcl.share_types.find(name='infinidat') if not share_type: - share_type = mcl.share_types.create(name='infinidat', - specs_driver_handles_file_share=False) + share_type = mcl.share_types.create( + name='infinidat', + specs_driver_handles_file_share=False) + class ManilaInfinidatTest(manila_tests.ManilaBaseTest): """Encapsulate Manila Infinidat NFS test.""" @@ -48,9 +54,9 @@ class ManilaInfinidatTest(manila_tests.ManilaBaseTest): # https://bugs.launchpad.net/python-manilaclient/+bug/1989577 # might be relevant mcl = manilaclient.Client( - session=cls.keystone_session, - client_version='2', - cacert=auth.get('OS_CACERT',None)) + session=cls.keystone_session, + client_version='2', + cacert=auth.get('OS_CACERT', None)) mcl = openstack_utils.get_manila_session_client(cls.keystone_session) diff --git a/tox.ini b/tox.ini index c44e830..9b286a9 100644 --- a/tox.ini +++ b/tox.ini @@ -64,6 +64,11 @@ basepython = python3.9 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +[testenv:py310] +basepython = python3.10 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + [testenv:py3] basepython = python3 deps = -r{toxinidir}/requirements.txt @@ -102,6 +107,7 @@ omit = .tox/* */charmhelpers/* unit_tests/* + templates/parts/backends [testenv:venv] basepython = python3