Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dataframe-jdbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ JDBC data sources.

See [Read from SQL databases](https://kotlin.github.io/dataframe/readsqldatabases.html) for more information
about how to use it.

### Testing
For testing DBMS specific changes there are two options:
Task that should be run manually, require installed [Docker daemon](https://www.docker.com/products/docker-desktop/):
`./gradlew :dataframe-jdbc:testcontainersTest`

Same tests, but with option to run without Docker, with locally installed databases:
`./gradlew :dataframe-jdbc:localDbTest`

As a fallback, there're H2 tests in compatibility mode that always run as a part of `./gradlew :dataframe-jdbc:check`.
49 changes: 49 additions & 0 deletions dataframe-jdbc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ dependencies {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
}
testImplementation(libs.hikaricp)
testImplementation(libs.testcontainers)
testImplementation(libs.testcontainers.postgresql)
testImplementation(libs.testcontainers.mysql)
testImplementation(libs.testcontainers.mariadb)
testImplementation(libs.testcontainers.mssqlserver)
}

buildConfig {
sourceSets.named("test") {
packageName = "org.jetbrains.kotlinx.dataframe.io.testcontainers"
className = "BuildConfig"
buildConfigField("MARIADB_IMAGE", "mariadb:${libs.versions.dockerImage.mariadb.get()}")
buildConfigField("MYSQL_IMAGE", "mysql:${libs.versions.dockerImage.mysql.get()}")
buildConfigField("POSTGRES_IMAGE", "postgres:${libs.versions.dockerImage.postgres.get()}")
buildConfigField("MSSQL_IMAGE", "mcr.microsoft.com/mssql/server:${libs.versions.dockerImage.mssql.get()}")
}
}

kotlinPublications {
Expand All @@ -47,3 +63,36 @@ kotlinPublications {
tasks.processKDocsMain {
dependsOn(tasks.generateBuildConfigClasses)
}

// Implementations of the abstract database tests running against databases in Docker containers
private val testcontainersTests = "org.jetbrains.kotlinx.dataframe.io.testcontainers.*"

// Implementations of the abstract database tests running against database servers on localhost
private val localDbTests = "org.jetbrains.kotlinx.dataframe.io.local.*LocalTest"
Comment thread
koperagen marked this conversation as resolved.

tasks.test {
filter {
excludeTestsMatching(testcontainersTests)
excludeTestsMatching(localDbTests)
}
}

tasks.register<Test>("testcontainersTest") {
description = "Runs tests that require Docker via Testcontainers."
group = LifecycleBasePlugin.VERIFICATION_GROUP
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
filter {
includeTestsMatching(testcontainersTests)
}
}

tasks.register<Test>("localDbTest") {
description = "Runs tests that require database servers running on localhost."
group = LifecycleBasePlugin.VERIFICATION_GROUP
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
filter {
includeTestsMatching(localDbTests)
}
}
Loading
Loading