diff options
author | Eliad Cohen <eliadcohen@gmail.com> | 2022-09-14 17:52:59 +0000 |
---|---|---|
committer | Eliad Cohen <eliadcohen@gmail.com> | 2022-11-28 17:04:29 +0000 |
commit | bec2d4daa00f66681043d582fc32d2a7a819c337 (patch) | |
tree | df183d79297c31bcfcf9513866a5e4fa47833f46 /tempest/scenario | |
parent | b39bbcc0bc5be39cc4d9e3cf2addf1924c8df49a (diff) | |
download | tempest-bec2d4daa00f66681043d582fc32d2a7a819c337.tar.gz |
Added functionality to wait for port creation
Added a waiter that compares the current status
of the port to a target value and returns the port
when that is achieved.
Closes-Bug: 1845486
Change-Id: Ibc5434244f3758c60ddefa96d78476948a47ed13
Diffstat (limited to 'tempest/scenario')
-rw-r--r-- | tempest/scenario/manager.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py index 2843498c6..bf3f62fa7 100644 --- a/tempest/scenario/manager.py +++ b/tempest/scenario/manager.py @@ -145,6 +145,7 @@ class ScenarioTest(tempest.test.BaseTestCase): - 'binding:vnic_type' - defaults to CONF.network.port_vnic_type - 'binding:profile' - defaults to CONF.network.port_profile """ + if not client: client = self.ports_client name = data_utils.rand_name( @@ -158,10 +159,12 @@ class ScenarioTest(tempest.test.BaseTestCase): network_id=network_id, **kwargs) self.assertIsNotNone(result, 'Unable to allocate port') - port = result['port'] + port_id = result['port']['id'] self.addCleanup(test_utils.call_and_ignore_notfound_exc, - client.delete_port, port['id']) - return port + client.delete_port, port_id) + port = waiters.wait_for_port_status( + client=client, port_id=port_id, status="DOWN") + return port["port"] def create_keypair(self, client=None, **kwargs): """Creates keypair |