Merge "[Fullstack] Add active waiting for one HA agent to be active for router" into stable/2024.2

This commit is contained in:
Zuul 2024-10-10 13:54:52 +00:00 committed by Gerrit Code Review
commit 6d89bd05c9

View File

@ -486,12 +486,21 @@ class TestHAL3Agent(TestL3Agent):
'active', 'active',
) )
def is_one_host_active_for_router():
active_hosts = get_active_hosts() active_hosts = get_active_hosts()
return len(active_hosts) == 1
# Only one host should be active try:
self.assertEqual(len(active_hosts), 1, common_utils.wait_until_true(
'More than one active HA routers') is_one_host_active_for_router, timeout=15)
except common_utils.WaitTimeout:
pass
# Test one last time:
active_hosts = get_active_hosts()
if len(active_hosts) != 1:
self.fail('Number of active hosts for router: %s',
len(active_hosts))
active_host = active_hosts[0] active_host = active_hosts[0]
backup_host = next( backup_host = next(
h for h in self.environment.hosts if h != active_host) h for h in self.environment.hosts if h != active_host)