integration-test.py: fix time delay check

This commit is contained in:
Simon Li
2022-11-27 21:28:43 +00:00
committed by Pris Nasrat
parent ae5fd64576
commit 20c6a851de

View File

@@ -2,7 +2,7 @@
import argparse import argparse
from shutil import which from shutil import which
import subprocess import subprocess
from time import time import time
import os import os
@@ -42,13 +42,13 @@ def check_container_ready(container_name, timeout=60):
""" """
Check if container is ready to run tests Check if container is ready to run tests
""" """
now = time() now = time.time()
while True: while True:
try: try:
container_check_output(["exec", "-t", container_name, "id"]) container_check_output(["exec", "-t", container_name, "id"])
return return
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
if time() - now > timeout: if time.time() - now > timeout:
raise RuntimeError(f"Container {container_name} hasn't started") raise RuntimeError(f"Container {container_name} hasn't started")
time.sleep(5) time.sleep(5)