Improve local integration test run script
Can now specify what targets to run
This commit is contained in:
@@ -5,22 +5,38 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
print("Building and running integration tests...")
|
if __name__ == "__main__":
|
||||||
print("Building Spoolman...")
|
print("Building and running integration tests...")
|
||||||
os.system("docker build -t donkie/spoolman:test .")
|
print("Building Spoolman...")
|
||||||
print("Building Spoolman tester...")
|
os.system("docker build -t donkie/spoolman:test .")
|
||||||
os.system("docker build -t donkie/spoolman-tester:latest tests_integration")
|
print("Building Spoolman tester...")
|
||||||
|
os.system("docker build -t donkie/spoolman-tester:latest tests_integration")
|
||||||
|
|
||||||
targets = [
|
# Support input arguments for running only specific tests
|
||||||
"postgres",
|
if len(sys.argv) > 1:
|
||||||
"sqlite",
|
targets = sys.argv[1:]
|
||||||
"mariadb",
|
# Check that all targets are valid
|
||||||
"cockroachdb",
|
for target in targets:
|
||||||
]
|
if target not in ["postgres", "sqlite", "mariadb", "cockroachdb"]:
|
||||||
|
print(f"Unknown target: {target}")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
print("No targets specified, running all tests...")
|
||||||
|
targets = [
|
||||||
|
"postgres",
|
||||||
|
"sqlite",
|
||||||
|
"mariadb",
|
||||||
|
"cockroachdb",
|
||||||
|
]
|
||||||
|
|
||||||
for target in targets:
|
for target in targets:
|
||||||
print(f"Running integration tests against {target}...")
|
print(f"Running integration tests against {target}...")
|
||||||
os.system(f"docker-compose -f tests_integration/docker-compose-{target}.yml down -v")
|
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:
|
if (
|
||||||
print(f"Integration tests against {target} failed!")
|
os.system(f"docker-compose -f tests_integration/docker-compose-{target}.yml up --abort-on-container-exit")
|
||||||
sys.exit(1)
|
> 0
|
||||||
|
):
|
||||||
|
print(f"Integration tests against {target} failed!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("Integration tests passed!")
|
||||||
|
|||||||
Reference in New Issue
Block a user