From 71037184185613f9c11544050398c8ec3ceb531d Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Sun, 18 Aug 2019 15:43:32 +0000 Subject: [PATCH] Skip tests if glance is not available There are some tests requiring glance service. If glance service is not available, we want to skip those tests instead of failing them. The following are the affected tests: * test_commit_container * test_run_container_with_image_driver_glance Change-Id: Iee1f53c905863eb842535090a2bb67c3babf9b05 --- .../tests/tempest/api/test_containers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zun_tempest_plugin/tests/tempest/api/test_containers.py b/zun_tempest_plugin/tests/tempest/api/test_containers.py index 33ade1c..89fd861 100644 --- a/zun_tempest_plugin/tests/tempest/api/test_containers.py +++ b/zun_tempest_plugin/tests/tempest/api/test_containers.py @@ -19,6 +19,7 @@ import types from oslo_serialization import jsonutils as json from oslo_utils import encodeutils import six +from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc @@ -29,6 +30,9 @@ from zun_tempest_plugin.tests.tempest import base from zun_tempest_plugin.tests.tempest import utils +CONF = config.CONF + + class TestContainer(base.BaseZunTest): credentials = ['primary', 'admin'] @@ -122,6 +126,9 @@ class TestContainer(base.BaseZunTest): @decorators.idempotent_id('c32f93e3-da88-4c13-be38-25d2e662a28e') def test_run_container_with_image_driver_glance(self): + if not CONF.service_available.glance: + raise self.skipException("This test requires glance service") + docker_base_url = self._get_docker_url() self.docker_client.pull_image( 'cirros', docker_auth_url=docker_base_url) @@ -522,6 +529,9 @@ class TestContainer(base.BaseZunTest): 4. Create another container from the snapshot image 5. Verify the pre-created file is there """ + if not CONF.service_available.glance: + raise self.skipException("This test requires glance service") + # This command creates a file inside the container command = ["/bin/sh", "-c", "echo hello > testfile;sleep 1000000"] _, model = self._run_container(command=command)