From 867c71ca83b67656afe89a6fe1056b4403fa4a40 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Fri, 19 Aug 2022 20:24:07 +0000 Subject: [PATCH] Fix date (deadline) calculation and comparison in test.py --- tests/compose/test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/compose/test.py b/tests/compose/test.py index 0b63e522..7ac16d73 100755 --- a/tests/compose/test.py +++ b/tests/compose/test.py @@ -6,6 +6,7 @@ from xmlrpc.client import DateTime import docker from colorama import Fore, Style import subprocess +import calendar # Declare variables for service name and sleep time test_name=sys.argv[1] @@ -57,7 +58,7 @@ def health_checks(deadline): if exit_code == 0: return True - elif exit_code != 0 and deadline > datetime.datetime.now(): + elif exit_code != 0 and deadline > datetime.datetime.now().timestamp(): stop(exit_code) def print_logs(): @@ -86,6 +87,7 @@ def hooks(): # Start up containers sys.stdout.flush() deadline=datetime.datetime.now()+datetime.timedelta(minutes=timeout) +deadline=calendar.timegm(deadline.timetuple()) print(subprocess.check_output("docker-compose -f " + compose_file + " up -d", shell=True).decode()) print() print(Fore.LIGHTMAGENTA_EX + "Sleeping for 10s" + Style.RESET_ALL)