Skip to content

Commit

Permalink
Display test runner progress inline
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Pukenis <[email protected]>
  • Loading branch information
LukasPukenis committed Jul 30, 2024
1 parent 97d4efd commit ba6b4eb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
import re
import time
import sys
from datetime import timedelta
from threading import Semaphore
from typing import Tuple

Expand Down Expand Up @@ -132,6 +134,7 @@ def run():
for s in scenarios:
total_containers += len(s.runners())

start_time = time.time()
while True:
if len(already_done) == len(scenarios):
break
Expand Down Expand Up @@ -202,8 +205,6 @@ def run():
info = ContainerHolder(container, scenario.id(), TESTCASE_TIMEOUT)
scenario_results[scenario.id()].append(info)

curr_time = time.strftime("%H:%M:%S", time.localtime())

done_containers = 0
failed_container_count = 0
for scenario in scenarios:
Expand All @@ -214,11 +215,11 @@ def run():
success, reason = container.success()
if not success:
failed_container_count += 1

print(
f"*** Test suite progress: {curr_time}: {done_containers}/{total_containers} containers finished, {failed_container_count} failed",
flush=True,
elapsed_time = str(timedelta(seconds=(round(time.time() - start_time))))
sys.stdout.write(
f"Testing in progress. Elapsed time: {elapsed_time}. Container exit stats: {done_containers}/{total_containers}, of those failed: {failed_container_count}\r"
)
sys.stdout.flush()

time.sleep(1)

Expand Down

0 comments on commit ba6b4eb

Please sign in to comment.