Skip to content

Commit

Permalink
Retry check to avoid live migration unstability.
Browse files Browse the repository at this point in the history
(cherry picked from commit b087c0c)
(cherry picked from commit e093e1b)
  • Loading branch information
freyes authored and wolsen committed Jan 4, 2024
1 parent 72457ba commit 851ac24
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions zaza/openstack/charm_tests/watcher/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Encapsulate Cinder testing."""

import logging
import tenacity

import zaza.openstack.charm_tests.test_utils as test_utils
import zaza.openstack.utilities.openstack as openstack_utils
Expand Down Expand Up @@ -43,6 +44,16 @@ def setUpClass(cls):

def test_server_consolidation(self):
"""Test server consolidation policy."""
for i, attempt in enumerate(tenacity.Retrying(
wait=tenacity.wait_fixed(2),
retry=tenacity.retry_if_exception_type(AssertionError),
reraise=True,
stop=tenacity.stop_after_attempt(4))):
with attempt:
logger.info('Attempt number %d', i + 1)
self._check_server_consolidation()

def _check_server_consolidation(self):
try:
at = self.watcher_client.audit_template.get(
self.AUDIT_TEMPLATE_NAME
Expand Down

0 comments on commit 851ac24

Please sign in to comment.