Skip to content

Commit 9cadc29

Browse files
committed
test(model-server): integration tests that run postgres using docker-compose
To test the ignite configuration for postgres and also the schema migrations we need an actual database.
1 parent bdc697f commit 9cadc29

File tree

6 files changed

+405
-0
lines changed

6 files changed

+405
-0
lines changed

model-server-test/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This project tests the PostgreSQL based Ignite configuration of the model-server
2+
by starting a database instance in docker.

model-server-test/build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
kotlin("jvm")
3+
alias(libs.plugins.docker.compose)
4+
}
5+
6+
dependencies {
7+
testImplementation(kotlin("test"))
8+
testImplementation(project(":model-server"))
9+
}
10+
11+
tasks.test {
12+
doFirst {
13+
val db = dockerCompose.servicesInfos.getValue("db")
14+
systemProperty("jdbc.url", "jdbc:postgresql://${db.host}:${db.port}/")
15+
}
16+
}
17+
18+
dockerCompose {
19+
isRequiredBy(tasks.test)
20+
setProjectName("model-server-test-started-from-gradle")
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
db:
3+
image: postgres:16.2
4+
volumes:
5+
- ./legacy-database.sql:/docker-entrypoint-initdb.d/initdb.sql
6+
environment:
7+
- POSTGRES_PASSWORD=modelix
8+
- POSTGRES_USER=modelix
9+
- POSTGRES_DB=modelix
10+
ports:
11+
- 5432

0 commit comments

Comments
 (0)