Merge "Add microversion support in scenario tests"

This commit is contained in:
Zuul 2019-06-05 05:07:55 +00:00 committed by Gerrit Code Review
commit 71536f97b8
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,14 @@
---
features:
- |
Add microversion support for scenario tests. Scenario test calls
multiple service API within same test and many services like compute,
volume and placement etc support API microversion. With microversion
support in scenario test, we can call different service API with
different microvesion. Which means we can implement scenario tests
for microversion also.
Currently Scenario manager support below services microversion:
* Compute
* Volume
* Placement

View File

@ -28,6 +28,8 @@ from tempest.common.utils import net_utils
from tempest.common import waiters
from tempest import config
from tempest import exceptions
from tempest.lib.common import api_microversion_fixture
from tempest.lib.common import api_version_utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions as lib_exc
@ -37,12 +39,57 @@ CONF = config.CONF
LOG = log.getLogger(__name__)
LATEST_MICROVERSION = 'latest'
class ScenarioTest(tempest.test.BaseTestCase):
"""Base class for scenario tests. Uses tempest own clients. """
credentials = ['primary']
compute_min_microversion = None
compute_max_microversion = LATEST_MICROVERSION
volume_min_microversion = None
volume_max_microversion = LATEST_MICROVERSION
placement_min_microversion = None
placement_max_microversion = LATEST_MICROVERSION
@classmethod
def skip_checks(cls):
super(ScenarioTest, cls).skip_checks()
api_version_utils.check_skip_with_microversion(
cls.compute_min_microversion, cls.compute_max_microversion,
CONF.compute.min_microversion, CONF.compute.max_microversion)
api_version_utils.check_skip_with_microversion(
cls.volume_min_microversion, cls.volume_max_microversion,
CONF.volume.min_microversion, CONF.volume.max_microversion)
api_version_utils.check_skip_with_microversion(
cls.placement_min_microversion, cls.placement_max_microversion,
CONF.placement.min_microversion, CONF.placement.max_microversion)
@classmethod
def resource_setup(cls):
super(ScenarioTest, cls).resource_setup()
cls.compute_request_microversion = (
api_version_utils.select_request_microversion(
cls.compute_min_microversion,
CONF.compute.min_microversion))
cls.volume_request_microversion = (
api_version_utils.select_request_microversion(
cls.volume_min_microversion,
CONF.volume.min_microversion))
cls.placement_request_microversion = (
api_version_utils.select_request_microversion(
cls.placement_min_microversion,
CONF.placement.min_microversion))
def setUp(self):
super(ScenarioTest, self).setUp()
self.useFixture(api_microversion_fixture.APIMicroversionFixture(
compute_microversion=self.compute_request_microversion,
volume_microversion=self.volume_request_microversion,
placement_microversion=self.placement_request_microversion))
@classmethod
def setup_clients(cls):
super(ScenarioTest, cls).setup_clients()