From f0be9b5136dd24f6deeb209d909df1ccd9eb87fb Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Fri, 15 Nov 2019 15:49:14 +0100 Subject: [PATCH 1/3] Add manila API test --- zaza/openstack/charm_tests/manila/__init__.py | 18 +++++++ zaza/openstack/charm_tests/manila/tests.py | 48 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 zaza/openstack/charm_tests/manila/__init__.py create mode 100644 zaza/openstack/charm_tests/manila/tests.py diff --git a/zaza/openstack/charm_tests/manila/__init__.py b/zaza/openstack/charm_tests/manila/__init__.py new file mode 100644 index 0000000..064c54c --- /dev/null +++ b/zaza/openstack/charm_tests/manila/__init__.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Copyright 2019 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +"""Encapsulate Manila setup and testing.""" diff --git a/zaza/openstack/charm_tests/manila/tests.py b/zaza/openstack/charm_tests/manila/tests.py new file mode 100644 index 0000000..e2ae24b --- /dev/null +++ b/zaza/openstack/charm_tests/manila/tests.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + +# Copyright 2019 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Encapsulate Manila testing.""" + + +from manilaclient import client as manilaclient + +import zaza.openstack.charm_tests.test_utils as test_utils +import zaza.openstack.utilities.openstack as openstack_utils + + +class ManilaTests(test_utils.OpenStackBaseTest): + """Encapsulate Manila tests.""" + + RESOURCE_PREFIX = 'zaza-manilatests' + INSTANCE_USERDATA = """#cloud-config +packages: +- nfs-common +""" + + @classmethod + def setUpClass(cls): + """Run class setup for running tests.""" + super(ManilaTests, cls).setUpClass() + cls.nova_client = ( + openstack_utils.get_nova_session_client(cls.keystone_session)) + cls.manila_client = manilaclient.Client( + session=cls.keystone_session, client_version='2') + + def test_manila_api(self): + """Test that the Manila API is working.""" + # now just try a list the shares + # NOTE(AJK) the 'search_opts={}' is to work around Bug#1707303 + self.manila.shares.list(search_opts={}) From 8b40d28ad1050e7e2d3485bb19aaebb3b1c664ea Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Tue, 3 Dec 2019 17:15:44 +0100 Subject: [PATCH 2/3] address tinwood's comments --- zaza/openstack/charm_tests/manila/tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/manila/tests.py b/zaza/openstack/charm_tests/manila/tests.py index e2ae24b..4caaffd 100644 --- a/zaza/openstack/charm_tests/manila/tests.py +++ b/zaza/openstack/charm_tests/manila/tests.py @@ -44,5 +44,4 @@ packages: def test_manila_api(self): """Test that the Manila API is working.""" # now just try a list the shares - # NOTE(AJK) the 'search_opts={}' is to work around Bug#1707303 - self.manila.shares.list(search_opts={}) + self.manila.shares.list() From a6bde7168310f8d80eb9a34ba1b23efa568f2059 Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Wed, 4 Dec 2019 10:19:53 +0100 Subject: [PATCH 3/3] remove unnecessary class variables --- zaza/openstack/charm_tests/manila/tests.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zaza/openstack/charm_tests/manila/tests.py b/zaza/openstack/charm_tests/manila/tests.py index 4caaffd..3ce7589 100644 --- a/zaza/openstack/charm_tests/manila/tests.py +++ b/zaza/openstack/charm_tests/manila/tests.py @@ -26,12 +26,6 @@ import zaza.openstack.utilities.openstack as openstack_utils class ManilaTests(test_utils.OpenStackBaseTest): """Encapsulate Manila tests.""" - RESOURCE_PREFIX = 'zaza-manilatests' - INSTANCE_USERDATA = """#cloud-config -packages: -- nfs-common -""" - @classmethod def setUpClass(cls): """Run class setup for running tests."""