Added some timing control for added consistency

This commit is contained in:
Omar Zevallos 2019-02-26 11:06:56 -08:00
Родитель 976be9c134
Коммит ca293232ce
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -31,6 +31,7 @@ def get_unused_local_port():
sock.bind(("", 0)) sock.bind(("", 0))
port = sock.getsockname()[1] port = sock.getsockname()[1]
sock.close() sock.close()
sleep(2) # for the port to fully free up
return port return port

Просмотреть файл

@ -8,6 +8,7 @@
import logging import logging
import os import os
import sys import sys
from time import sleep, time
# from requirements.txt # from requirements.txt
import pytest import pytest
@ -43,10 +44,20 @@ class TestVfxtClusterStatus:
def test_node_health(self, averecmd_params): # noqa: F811 def test_node_health(self, averecmd_params): # noqa: F811
"""Check that cluster is reporting that all nodes are up.""" """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"): for node in run_averecmd(**averecmd_params, method="node.list"):
timeout_secs = 60
time_start = time()
time_end = time_start + timeout_secs
while time() <= time_end:
result = run_averecmd(**averecmd_params, result = run_averecmd(**averecmd_params,
method="node.get", args=node) method="node.get", args=node)
assert result[node]["state"] == "up" 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 def test_ha_enabled(self, averecmd_params): # noqa: F811
"""Check that high-availability (HA) is enabled.""" """Check that high-availability (HA) is enabled."""