The neutron_taas.tests.tempest_plugin.tests.scenario.test_taas Module

class neutron_taas.tests.tempest_plugin.tests.scenario.test_taas.TestTaaS(*args, **kwargs)

Bases: neutron_taas.tests.tempest_plugin.tests.scenario.base.TaaSScenarioTest

classmethod resource_setup()

Class level resource setup for test cases.

resource_setup is invoked once all credentials (and related network resources have been provisioned and after client aliases - if any - have been defined.

The use case for resource_setup is test optimization: provisioning of project-specific “expensive” resources that are not dirtied by tests and can thus safely be re-used by multiple tests.

System wide resources shared by all tests could instead be provisioned only once, before the test run.

Resources provisioned here must be cleaned up during resource_cleanup. This is best achieved by scheduling a cleanup via addClassResourceCleanup.

Some test resources have an asynchronous delete process. It’s best practice for them to schedule a wait for delete via addClassResourceCleanup to avoid having resources in process of deletion when we reach the credentials cleanup step.

Example:

@classmethod
def resource_setup(cls):
    super(MyTest, cls).resource_setup()
    servers = cls.os_primary.compute.ServersClient()
    # Schedule delete and wait so that we can first delete the
    # two servers and then wait for both to delete
    # Create server 1
    cls.shared_server = servers.create_server()
    # Create server 2. If something goes wrong we schedule cleanup
    # of server 1 anyways.
    try:
        cls.shared_server2 = servers.create_server()
        # Wait server 2
        cls.addClassResourceCleanup(
            waiters.wait_for_server_termination,
            servers, cls.shared_server2['id'],
            ignore_error=False)
    finally:
        # Wait server 1
        cls.addClassResourceCleanup(
            waiters.wait_for_server_termination,
            servers, cls.shared_server['id'],
            ignore_error=False)
            # Delete server 1
        cls.addClassResourceCleanup(
            test_utils.call_and_ignore_notfound_exc,
            servers.delete_server,
            cls.shared_server['id'])
        # Delete server 2 (if it was created)
        if hasattr(cls, 'shared_server2'):
            cls.addClassResourceCleanup(
                test_utils.call_and_ignore_notfound_exc,
                servers.delete_server,
                cls.shared_server2['id'])
test_dummy()

Test idempotent id: 40903cbd-0e3c-464d-b311-dc77d3894e65