Skip to content

Commit

Permalink
Run integration tests on all db types
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed May 21, 2023
1 parent ba6fb62 commit 5e75d6d
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions tests_integration/docker-compose-cockroachdb.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions tests_integration/docker-compose-mariadb.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions tests_integration/docker-compose-sqlite.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions tests_integration/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
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")

0 comments on commit 5e75d6d

Please sign in to comment.