Skip to content

Commit b007d4e

Browse files
authored
Merge pull request #429 from simplito/fix/e2e_runner_for_github_action
fix: e2e_runner config to work with githuc actions
2 parents 4f77ab9 + f6a6fc8 commit b007d4e

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ jobs:
4444
- name: Start Backend Services
4545
run: |
4646
cd test
47-
docker compose up -d
48-
sleep 15
47+
docker compose up -d --wait
4948
5049
- name: Run tests
5150
run: |
5251
source build/build/Debug/generators/conanrun.sh
5352
cd test
54-
python3 e2e_runner.py ../build/test "test_env/create_dataset/Dataset/ServerData.ini" "test_env/create_dataset/Dataset"
53+
python3 e2e_runner.py --max-workers 2 ../build/test "test_env/create_dataset/Dataset/ServerData.ini" "test_env/create_dataset/Dataset"

test/e2e_runner.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
MAX_WORKERS = 4
3030
TIMEOUT_PER_TEST = 300
31-
RETRY_COUNT = 0
31+
RETRY_COUNT = 1
3232
RETRY_DELAY = 5
3333

3434
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
@@ -213,7 +213,7 @@ def load_bridge_dataset(dataset_path: str, bridge_container_name: str) -> None:
213213
)
214214

215215

216-
def wait_for_server_ready(port: int, container_name: str, timeout_seconds: int = 10) -> None:
216+
def wait_for_server_ready(port: int, container_name: str, timeout_seconds: int = 30) -> None:
217217
url = f"http://localhost:{port}/privmx-configuration.json"
218218
deadline = time.time() + timeout_seconds
219219

@@ -615,6 +615,13 @@ def parse_cli_args(argv: Sequence[str]) -> tuple[argparse.Namespace, str | None,
615615
action="store_true",
616616
help="Create/update test/.venv and install Python dependencies before running tests.",
617617
)
618+
parser.add_argument(
619+
"--max-workers",
620+
type=int,
621+
default=MAX_WORKERS,
622+
metavar="N",
623+
help=f"Maximum number of tests to run in parallel (default: {MAX_WORKERS}).",
624+
)
618625
parser.add_argument("tests_dir", nargs="?")
619626
parser.add_argument("init_file_path", nargs="?")
620627
parser.add_argument("dataset_dir", nargs="?")
@@ -666,6 +673,7 @@ def main(
666673
dataset_dir_path: str,
667674
run_passthrough_args: Sequence[str],
668675
selected_filter: str | None,
676+
max_workers: int = MAX_WORKERS,
669677
) -> int:
670678
validate_input_paths(test_dir_path, init_file_path, dataset_dir_path)
671679

@@ -686,7 +694,7 @@ def main(
686694

687695
scheduled_tests += len(tests)
688696
print(f"Found {len(tests)} tests in {test_file}")
689-
with ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
697+
with ThreadPoolExecutor(max_workers=max_workers) as executor:
690698
futures = [
691699
executor.submit(
692700
run_single_test,
@@ -740,5 +748,6 @@ def main(
740748
dataset_dir_path,
741749
run_passthrough_args,
742750
selected_filter,
751+
args.max_workers,
743752
)
744753
raise SystemExit(0 if result == 0 else 1)

0 commit comments

Comments
 (0)