Skip to content

Commit bf8edd2

Browse files
authored
Merge pull request #1369 from freyes/retry-pacemaker-remote
Retry pacemaker remote
2 parents 048a8c7 + 9aa791e commit bf8edd2

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

  • zaza/openstack/charm_tests/pacemaker_remote

zaza/openstack/charm_tests/pacemaker_remote/tests.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,41 @@
1818

1919
import unittest
2020

21+
import tenacity
22+
import zaza.model
2123
import zaza.openstack.configure.hacluster
24+
import zaza.openstack.utilities.generic as generic_utils
2225

2326

2427
class PacemakerRemoteTest(unittest.TestCase):
2528
"""Encapsulate pacemaker-remote tests."""
2629

2730
def test_check_nodes_online(self):
2831
"""Test that all nodes are online."""
32+
for attempt in tenacity.Retrying(
33+
reraise=True,
34+
stop=tenacity.stop_after_attempt(5),
35+
wait=tenacity.wait_fixed(5),
36+
):
37+
with attempt:
38+
zaza.openstack.configure.hacluster.check_all_nodes_online(
39+
'api'
40+
)
41+
units = zaza.model.get_units('pacemaker-remote')
42+
last_unit = units[-1]
43+
node_names = generic_utils.get_unit_hostnames(units)
44+
node_name = node_names[last_unit.entity_id]
2945
zaza.openstack.configure.hacluster.remove_node(
3046
'api',
31-
'node1')
32-
self.assertTrue(
33-
zaza.openstack.configure.hacluster.check_all_nodes_online('api'))
47+
node_name)
48+
for attempt in tenacity.Retrying(
49+
reraise=True,
50+
stop=tenacity.stop_after_attempt(5),
51+
wait=tenacity.wait_fixed(5),
52+
):
53+
with attempt:
54+
self.assertTrue(
55+
zaza.openstack.configure.hacluster.check_all_nodes_online(
56+
'api'
57+
)
58+
)

0 commit comments

Comments
 (0)