From dc9a3458add51d3cd48b0594e38b8842fc1fc39c Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sat, 29 Apr 2017 14:39:35 +0000 Subject: [PATCH] functional tests: minor cleanup * Check service availability for swift, heat and octavia * Use OS_CLOUD=devstack-admin. DevStack sets up default clouds.yaml for member and admin roles. The current OpenStackSDK functest prepares its own clouds.yaml based on DevStack admin account, so there is no difference from 'devstack-admin'. It simplifies the post_gate_hook process. * Skip openstack.tests.functional.network.v2.test_quota.TestQuota.test_set (Related-Bug: #1687202) Change-Id: I571e437dd7e439d2ad8a1d7ed9a5a24361b1308e --- examples/connect.py | 4 ++-- openstack/tests/functional/base.py | 4 ++-- .../tests/functional/load_balancer/v2/test_load_balancer.py | 3 +++ openstack/tests/functional/network/v2/test_quota.py | 3 +++ openstack/tests/functional/object_store/v1/test_account.py | 4 ++++ .../tests/functional/object_store/v1/test_container.py | 3 +++ openstack/tests/functional/object_store/v1/test_obj.py | 3 +++ openstack/tests/functional/orchestration/v1/test_stack.py | 2 ++ post_test_hook.sh | 6 ++---- 9 files changed, 24 insertions(+), 8 deletions(-) diff --git a/examples/connect.py b/examples/connect.py index 1cf195ff..07216ae1 100644 --- a/examples/connect.py +++ b/examples/connect.py @@ -32,11 +32,11 @@ utils.enable_logging(True, stream=sys.stdout) #: file, typically in $HOME/.config/openstack/clouds.yaml. That configuration #: will determine where the examples will be run and what resource defaults #: will be used to run the examples. -TEST_CLOUD = os.getenv('OS_TEST_CLOUD', 'test_cloud') +TEST_CLOUD = os.getenv('OS_TEST_CLOUD', 'devstack-admin') class Opts(object): - def __init__(self, cloud_name='test_cloud', debug=False): + def __init__(self, cloud_name='devstack-admin', debug=False): self.cloud = cloud_name self.debug = debug # Use identity v3 API for examples. diff --git a/openstack/tests/functional/base.py b/openstack/tests/functional/base.py index 57544a91..9eb4eba4 100644 --- a/openstack/tests/functional/base.py +++ b/openstack/tests/functional/base.py @@ -23,11 +23,11 @@ from openstack import connection #: file, typically in $HOME/.config/openstack/clouds.yaml. That configuration #: will determine where the functional tests will be run and what resource #: defaults will be used to run the functional tests. -TEST_CLOUD = os.getenv('OS_CLOUD', 'test_cloud') +TEST_CLOUD = os.getenv('OS_CLOUD', 'devstack-admin') class Opts(object): - def __init__(self, cloud_name='test_cloud', debug=False): + def __init__(self, cloud_name='devstack-admin', debug=False): self.cloud = cloud_name self.debug = debug diff --git a/openstack/tests/functional/load_balancer/v2/test_load_balancer.py b/openstack/tests/functional/load_balancer/v2/test_load_balancer.py index 4082a119..acf95349 100644 --- a/openstack/tests/functional/load_balancer/v2/test_load_balancer.py +++ b/openstack/tests/functional/load_balancer/v2/test_load_balancer.py @@ -10,12 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import unittest import uuid from openstack.load_balancer.v2 import load_balancer from openstack.tests.functional import base +@unittest.skipUnless(base.service_exists(service_type='load_balancer'), + 'Load-balancing service does not exist') class TestLoadBalancer(base.BaseFunctionalTest): NAME = uuid.uuid4().hex diff --git a/openstack/tests/functional/network/v2/test_quota.py b/openstack/tests/functional/network/v2/test_quota.py index 9fa10045..14be76dd 100644 --- a/openstack/tests/functional/network/v2/test_quota.py +++ b/openstack/tests/functional/network/v2/test_quota.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import unittest + from openstack.tests.functional import base @@ -20,6 +22,7 @@ class TestQuota(base.BaseFunctionalTest): self.assertIsNotNone(qot.project_id) self.assertIsNotNone(qot.networks) + @unittest.skip('bug/1687202') def test_set(self): attrs = {'networks': 123456789} for project_quota in self.conn.network.quotas(): diff --git a/openstack/tests/functional/object_store/v1/test_account.py b/openstack/tests/functional/object_store/v1/test_account.py index 879f1526..fe258db8 100644 --- a/openstack/tests/functional/object_store/v1/test_account.py +++ b/openstack/tests/functional/object_store/v1/test_account.py @@ -10,9 +10,13 @@ # License for the specific language governing permissions and limitations # under the License. +import unittest + from openstack.tests.functional import base +@unittest.skipUnless(base.service_exists(service_type='object-store'), + 'Object Storage service does not exist') class TestAccount(base.BaseFunctionalTest): @classmethod diff --git a/openstack/tests/functional/object_store/v1/test_container.py b/openstack/tests/functional/object_store/v1/test_container.py index 206f3721..0a6dc754 100644 --- a/openstack/tests/functional/object_store/v1/test_container.py +++ b/openstack/tests/functional/object_store/v1/test_container.py @@ -10,12 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import unittest import uuid from openstack.object_store.v1 import container as _container from openstack.tests.functional import base +@unittest.skipUnless(base.service_exists(service_type='object-store'), + 'Object Storage service does not exist') class TestContainer(base.BaseFunctionalTest): NAME = uuid.uuid4().hex diff --git a/openstack/tests/functional/object_store/v1/test_obj.py b/openstack/tests/functional/object_store/v1/test_obj.py index 89990f20..ace53ced 100644 --- a/openstack/tests/functional/object_store/v1/test_obj.py +++ b/openstack/tests/functional/object_store/v1/test_obj.py @@ -10,11 +10,14 @@ # License for the specific language governing permissions and limitations # under the License. +import unittest import uuid from openstack.tests.functional import base +@unittest.skipUnless(base.service_exists(service_type='object-store'), + 'Object Storage service does not exist') class TestObject(base.BaseFunctionalTest): FOLDER = uuid.uuid4().hex diff --git a/openstack/tests/functional/orchestration/v1/test_stack.py b/openstack/tests/functional/orchestration/v1/test_stack.py index 6da67484..73dc1933 100644 --- a/openstack/tests/functional/orchestration/v1/test_stack.py +++ b/openstack/tests/functional/orchestration/v1/test_stack.py @@ -19,6 +19,8 @@ from openstack.tests.functional.network.v2 import test_network @unittest.skip("bug/1525005") +@unittest.skipUnless(base.service_exists(service_type='orchestration'), + 'Orchestration service does not exist') class TestStack(base.BaseFunctionalTest): NAME = 'test_stack' diff --git a/post_test_hook.sh b/post_test_hook.sh index b40b0d98..567dd1f7 100755 --- a/post_test_hook.sh +++ b/post_test_hook.sh @@ -8,11 +8,9 @@ DIR=$(cd $(dirname "$0") && pwd) echo "Running SDK functional test suite" sudo -H -u stack -i <