Merge "Remove _create_port and rebuild_server methods"

This commit is contained in:
Zuul 2023-07-13 16:30:06 +00:00 committed by Gerrit Code Review
commit 6e05590a90
1 changed files with 2 additions and 35 deletions

View File

@ -25,14 +25,14 @@ from tempest import exceptions
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions as lib_exc
import tempest.test
import tempest.scenario.manager
CONF = config.CONF
LOG = log.getLogger(__name__)
class ScenarioTest(tempest.test.BaseTestCase):
class ScenarioTest(tempest.scenario.manager.ScenarioTest):
"""Base class for scenario tests. Uses tempest own clients. """
credentials = ['primary', 'admin']
@ -81,21 +81,6 @@ class ScenarioTest(tempest.test.BaseTestCase):
# The create_[resource] functions only return body and discard the
# resp part which is not used in scenario tests
def _create_port(self, network_id, client=None, namestart='port-quotatest',
**kwargs):
if not client:
client = self.ports_client
name = data_utils.rand_name(namestart)
result = client.create_port(
name=name,
network_id=network_id,
**kwargs)
self.assertIsNotNone(result, 'Unable to allocate port')
port = result['port']
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
client.delete_port, port['id'])
return port
def create_keypair(self, client=None):
if not client:
client = self.keypairs_client
@ -221,24 +206,6 @@ class ScenarioTest(tempest.test.BaseTestCase):
self.image_client.store_image_file(image['id'], image_file)
return image['id']
def rebuild_server(self, server_id, image=None,
preserve_ephemeral=False, wait=True,
rebuild_kwargs=None):
if image is None:
image = CONF.compute.image_ref
rebuild_kwargs = rebuild_kwargs or {}
LOG.debug("Rebuilding server (id: %s, image: %s, preserve eph: %s)",
server_id, image, preserve_ephemeral)
self.servers_client.rebuild_server(
server_id=server_id, image_ref=image,
preserve_ephemeral=preserve_ephemeral,
**rebuild_kwargs)
if wait:
waiters.wait_for_server_status(self.servers_client,
server_id, 'ACTIVE')
def create_floating_ip(self, thing, pool_name=None):
"""Create a floating IP and associates to a server on Nova"""