Change pool create scenario test to wait for operating status
The API test for pool creation has a check to wait for the
operating status of a pool to transition to ONLINE if a
listener has been provided.
The scenario test for pool creation doesn't wait for any
operating status transition after a pool is created with
a listener, and instead always assumes it's OFFLINE.
They should both wait for a transition, since otherwise
drivers that transition to ONLINE quickly, like OVN, can
race and fail the scenario test.
Depends-on: https://review.opendev.org/c/openstack/octavia/+/763530
Change-Id: I9eb3c7ce8af879cd910b06234c99b53670907e49
Story: 2008009
Task: 40659
diff --git a/octavia_tempest_plugin/tests/api/v2/test_pool.py b/octavia_tempest_plugin/tests/api/v2/test_pool.py
index 52de166..3ab4892 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_pool.py
@@ -443,6 +443,8 @@
const.ONLINE,
CONF.load_balancer.build_interval,
CONF.load_balancer.build_timeout)
+ else:
+ self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
self.assertEqual(pool_name, pool[const.NAME])
self.assertEqual(pool_description, pool[const.DESCRIPTION])
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
index ae2ef67..6df4c9c 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
@@ -434,7 +434,6 @@
parser.parse(pool[const.CREATED_AT])
parser.parse(pool[const.UPDATED_AT])
UUID(pool[const.ID])
- self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
self.assertEqual(pool_protocol, pool[const.PROTOCOL])
self.assertEqual(1, len(pool[const.LOADBALANCERS]))
self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
@@ -443,6 +442,7 @@
self.assertEqual(listener_id, pool[const.LISTENERS][0][const.ID])
else:
self.assertEmpty(pool[const.LISTENERS])
+ self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
self.assertEqual(algorithm, pool[const.LB_ALGORITHM])
if session_persistence == const.SESSION_PERSISTENCE_APP_COOKIE:
@@ -510,6 +510,13 @@
self.assertEqual(new_description, pool[const.DESCRIPTION])
self.assertTrue(pool[const.ADMIN_STATE_UP])
self.assertEqual(algorithm, pool[const.LB_ALGORITHM])
+ if listener_protocol is not None:
+ pool = waiters.wait_for_status(
+ self.mem_pool_client.show_pool,
+ pool[const.ID], const.OPERATING_STATUS,
+ const.ONLINE,
+ CONF.load_balancer.build_interval,
+ CONF.load_balancer.build_timeout)
if session_persistence == const.SESSION_PERSISTENCE_APP_COOKIE:
self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE))