Fix skipping of tests

The plugin defines a 'watcher' option in the '[service_available]' group
but does not respect it, so if the plugin is installed but
[service_available]/watcher=false, the tests will still run unless
blacklisted. This patch corrects the issue by defining the tempest
skip_checks class method.

Change-Id: Iba29ac0d05f56c83b3be4856ae671f9ae2d31486
This commit is contained in:
Xing Zhang 2020-01-15 14:30:23 +08:00
parent 55a829626f
commit 85df1a6d7a
No known key found for this signature in database
GPG Key ID: 43F80E57B910E3B0
2 changed files with 15 additions and 0 deletions

View File

@ -17,12 +17,15 @@
import functools
import time
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest import test
from watcher_tempest_plugin import infra_optim_clients as clients
CONF = config.CONF
class BaseInfraOptimTest(test.BaseTestCase):
"""Base class for Infrastructure Optimization API tests."""
@ -39,6 +42,12 @@ class BaseInfraOptimTest(test.BaseTestCase):
'CANCELLED',
'SUPERSEDED')
@classmethod
def skip_checks(cls):
super(BaseInfraOptimTest, cls).skip_checks()
if not CONF.service_available.watcher:
raise cls.skipException('Watcher support is required')
@classmethod
def setup_credentials(cls):
super(BaseInfraOptimTest, cls).setup_credentials()

View File

@ -31,6 +31,12 @@ class ScenarioTest(tempest.test.BaseTestCase):
credentials = ['primary', 'admin']
@classmethod
def skip_checks(cls):
super(ScenarioTest, cls).skip_checks()
if not CONF.service_available.watcher:
raise cls.skipException('Watcher support is required')
@classmethod
def setup_clients(cls):
super(ScenarioTest, cls).setup_clients()