Run integration tests on all db types

This commit is contained in:
Donkie
2023-05-21 23:38:41 +02:00
parent ba6fb62c7b
commit 5e75d6d70e
5 changed files with 92 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ jobs:
needs: [build, build-tester]
strategy:
matrix:
dbtype: ["postgres"]
dbtype: ["postgres", "sqlite", "mariadb", "cockroachdb"]
runs-on: ubuntu-latest
steps:
- name: Checkout

View File

@@ -0,0 +1,39 @@
version: '3.9'
services:
db:
image: cockroachdb/cockroach:v23.1.1
command: start-single-node
environment:
- COCKROACH_USER=john
- COCKROACH_PASSWORD=abc
- COCKROACH_DATABASE=spoolman
healthcheck:
test:
[
"CMD",
"curl",
"-f",
"http://localhost:8080/health?ready=1"
]
interval: 5s
timeout: 10s
retries: 5
spoolman:
image: donkie/spoolman:test
environment:
- SPOOLMAN_DB_TYPE=cockroachdb
- SPOOLMAN_DB_HOST=db
- SPOOLMAN_DB_PORT=26257
- SPOOLMAN_DB_NAME=spoolman
- SPOOLMAN_DB_USERNAME=john
- SPOOLMAN_DB_PASSWORD=abc
- SPOOLMAN_LOGGING_LEVEL=DEBUG
depends_on:
db:
condition: service_healthy
tester:
image: donkie/spoolman-tester:latest
volumes:
- ./tests:/tester/tests
depends_on:
- spoolman

View File

@@ -0,0 +1,33 @@
version: '3.9'
services:
db:
image: mariadb:latest
environment:
- MARIADB_USER=john
- MARIADB_RANDOM_ROOT_PASSWORD=yes
- MARIADB_PASSWORD=abc
- MARIADB_DATABASE=spoolman
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
interval: 1s
timeout: 20s
retries: 10
spoolman:
image: donkie/spoolman:test
environment:
- SPOOLMAN_DB_TYPE=mysql
- SPOOLMAN_DB_HOST=db
- SPOOLMAN_DB_PORT=3306
- SPOOLMAN_DB_NAME=spoolman
- SPOOLMAN_DB_USERNAME=john
- SPOOLMAN_DB_PASSWORD=abc
- SPOOLMAN_LOGGING_LEVEL=DEBUG
depends_on:
db:
condition: service_healthy
tester:
image: donkie/spoolman-tester:latest
volumes:
- ./tests:/tester/tests
depends_on:
- spoolman

View File

@@ -0,0 +1,13 @@
version: '3.8'
services:
spoolman:
image: donkie/spoolman:test
environment:
- SPOOLMAN_DB_TYPE=sqlite
- SPOOLMAN_LOGGING_LEVEL=DEBUG
tester:
image: donkie/spoolman-tester:latest
volumes:
- ./tests:/tester/tests
depends_on:
- spoolman

View File

@@ -6,3 +6,9 @@ os.system("docker build -t donkie/spoolman:test .")
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")