Allow passing validation_resources in scenario

In the scenario manager, we need to pass through validation parameters
if they are passed to us. If not, we need to do the needful for
SSHABLE targets, but some tests need to pass in their own. Note that
the scenario manager create_server() already has a validatable
parameter, but it does *not* pass that through to create_test_server(),
so we also need to fix that up for those cases to avoid tripping
over the assertion requirement that it be provided.

Change-Id: I44b3deba70e3f33f1287a6b3f28c21da5492cc04
This commit is contained in:
Dan Smith 2023-05-04 09:06:41 -07:00
parent 8f9c77b368
commit 6574469293

View File

@ -195,7 +195,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
return body['keypair']
def create_server(self, name=None, image_id=None, flavor=None,
validatable=False, wait_until='ACTIVE',
validatable=None, wait_until='ACTIVE',
clients=None, **kwargs):
"""Wrapper utility that returns a test server.
@ -320,8 +320,10 @@ class ScenarioTest(tempest.test.BaseTestCase):
kwargs.setdefault('availability_zone',
CONF.compute.compute_volume_common_az)
kwargs['validatable'] = bool(validatable)
keypair = kwargs.pop('keypair', None)
if wait_until == 'SSHABLE':
if wait_until == 'SSHABLE' and (
kwargs.get('validation_resources') is None):
# NOTE(danms): We should do this whether valdiation is enabled or
# not to consistently provide the resources to the
# create_test_server() function. If validation is disabled, then
@ -333,8 +335,10 @@ class ScenarioTest(tempest.test.BaseTestCase):
validation_resources = copy.deepcopy(validation_resources)
validation_resources.update(
keypair=keypair)
kwargs.update({'validatable': True,
'validation_resources': validation_resources})
kwargs.update({
'validatable': (validatable if validatable is not None
else True),
'validation_resources': validation_resources})
if keypair:
kwargs.update({'key_name': keypair['name']})