Fix skipping of tests

The plugin defines a 'magnum' option in the '[service_available]' group
but does not respect it, so if the plugin is installed but
[service_available]/magnum=false, the tests will still run unless
blacklisted. This patch corrects the issue by defining the tempest
skip_checks class method. This also requires using the correct tempest
base class as recommended in the tempest guide[1].

[1] https://docs.openstack.org/tempest/latest/write_tests.html

Change-Id: I6b9a8f802129fa800d9f4a3eadd8943962c951c0
This commit is contained in:
Colleen Murphy 2019-02-22 11:15:51 +01:00
parent 72a29d8e43
commit 5a18c8ebf0
1 changed files with 13 additions and 2 deletions

View File

@ -14,15 +14,17 @@ import logging
import os
import subprocess
from tempest.lib import base
from tempest import config
from tempest import test
import magnum_tempest_plugin
CONF = config.CONF
COPY_LOG_HELPER = "magnum_tempest_plugin/tests/contrib/copy_instance_logs.sh"
class BaseMagnumTest(base.BaseTestCase):
class BaseMagnumTest(test.BaseTestCase):
"""Sets up configuration required for functional tests"""
LOG = logging.getLogger(__name__)
@ -30,6 +32,15 @@ class BaseMagnumTest(base.BaseTestCase):
def __init__(self, *args, **kwargs):
super(BaseMagnumTest, self).__init__(*args, **kwargs)
@classmethod
def skip_checks(cls):
super(BaseMagnumTest, cls).skip_checks()
if not CONF.service_available.magnum:
skip_msg = ("%s skipped as magnum is not available"
% cls.__name__)
raise cls.skipException(skip_msg)
@classmethod
def copy_logs_handler(cls, get_nodes_fn, coe, keypair):
"""Copy logs closure.