From 11eec3c259f23f2929ab42d30dd88e655672feba Mon Sep 17 00:00:00 2001 From: Donkie Date: Fri, 30 Jun 2023 21:52:33 +0200 Subject: [PATCH] Improved local integration test script --- tests_integration/run.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tests_integration/run.py b/tests_integration/run.py index d78c583..cd2c4ed 100644 --- a/tests_integration/run.py +++ b/tests_integration/run.py @@ -1,16 +1,26 @@ """Build and run the integration tests.""" -# ruff: noqa: S605, S607 +# ruff: noqa: S605, S607, T201 import os +import sys +print("Building and running integration tests...") +print("Building Spoolman...") os.system("docker build -t donkie/spoolman:test .") +print("Building Spoolman tester...") os.system("docker build -t donkie/spoolman-tester:latest tests_integration") -os.system("docker-compose -f tests_integration/docker-compose-postgres.yml down -v") -os.system("docker-compose -f tests_integration/docker-compose-postgres.yml up --abort-on-container-exit") -os.system("docker-compose -f tests_integration/docker-compose-sqlite.yml down -v") -os.system("docker-compose -f tests_integration/docker-compose-sqlite.yml up --abort-on-container-exit") -os.system("docker-compose -f tests_integration/docker-compose-mariadb.yml down -v") -os.system("docker-compose -f tests_integration/docker-compose-mariadb.yml up --abort-on-container-exit") -os.system("docker-compose -f tests_integration/docker-compose-cockroachdb.yml down -v") -os.system("docker-compose -f tests_integration/docker-compose-cockroachdb.yml up --abort-on-container-exit") + +targets = [ + "postgres", + "sqlite", + "mariadb", + "cockroachdb", +] + +for target in targets: + print(f"Running integration tests against {target}...") + os.system(f"docker-compose -f tests_integration/docker-compose-{target}.yml down -v") + if os.system(f"docker-compose -f tests_integration/docker-compose-{target}.yml up --abort-on-container-exit") > 0: + print(f"Integration tests against {target} failed!") + sys.exit(1)