diff --git a/test/lib/helpers.py b/test/lib/helpers.py index 0d4486a6..b12bf05e 100644 --- a/test/lib/helpers.py +++ b/test/lib/helpers.py @@ -31,6 +31,7 @@ def get_unused_local_port(): sock.bind(("", 0)) port = sock.getsockname()[1] sock.close() + sleep(2) # for the port to fully free up return port diff --git a/test/test_vfxt_cluster_status.py b/test/test_vfxt_cluster_status.py index 56e12f96..6114e438 100644 --- a/test/test_vfxt_cluster_status.py +++ b/test/test_vfxt_cluster_status.py @@ -8,6 +8,7 @@ import logging import os import sys +from time import sleep, time # from requirements.txt import pytest @@ -43,10 +44,20 @@ class TestVfxtClusterStatus: def test_node_health(self, averecmd_params): # noqa: F811 """Check that cluster is reporting that all nodes are up.""" + log = logging.getLogger("test_node_health") for node in run_averecmd(**averecmd_params, method="node.list"): - result = run_averecmd(**averecmd_params, - method="node.get", args=node) - assert result[node]["state"] == "up" + timeout_secs = 60 + time_start = time() + time_end = time_start + timeout_secs + while time() <= time_end: + result = run_averecmd(**averecmd_params, + method="node.get", args=node) + node_state = result[node]["state"] + log.info('Node {0} has state "{1}"'.format(node, node_state)) + if node_state == "up": + break + sleep(10) + assert node_state == "up" def test_ha_enabled(self, averecmd_params): # noqa: F811 """Check that high-availability (HA) is enabled."""