Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
[CALCITE-5006] Gradle tasks for launching JDBC integration tests are …
Browse files Browse the repository at this point in the history
…not working

1. Resolve the problem by removing the custom set of testClassesDirs
2. Set correctly the classpath to include JDBC drivers from a custom
configuration.
3. Add a bit of documentation around the JDBC tasks and configs.

Close apache#2716
  • Loading branch information
zabetak committed Feb 14, 2022
1 parent 5b2de4e commit 89b7091
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ val integrationTestConfig: (Configuration.() -> Unit) = {
extendsFrom(configurations.testRuntimeClasspath.get())
}

// The custom configurations below allow to include dependencies (and jars) in the classpath only
// when IT tests are running. In the future it may make sense to include the JDBC driver
// dependencies using the default 'testRuntimeOnly' configuration to simplify the build but at the
// moment they can remain as is.
val testH2 by configurations.creating(integrationTestConfig)
val testOracle by configurations.creating(integrationTestConfig)
val testPostgresql by configurations.creating(integrationTestConfig)
Expand Down Expand Up @@ -258,17 +262,16 @@ val integTestAll by tasks.registering() {
description = "Executes integration JDBC tests for all DBs"
}

val coreTestClasses = sourceSets.main.get().output
val coreClasses = sourceSets.main.get().output + coreTestClasses
for (db in listOf("h2", "mysql", "oracle", "postgresql")) {
val task = tasks.register("integTest" + db.capitalize(), Test::class) {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Executes integration JDBC tests with $db database"
include("org/apache/calcite/test/JdbcAdapterTest.class")
include("org/apache/calcite/test/JdbcTest.class")
systemProperty("calcite.test.db", db)
testClassesDirs = coreTestClasses.classesDirs
classpath = coreClasses + configurations.getAt("test" + db.capitalize())
// Include the jars from the custom configuration to the classpath
// otherwise the JDBC drivers for each DBMS will be missing
classpath = classpath + configurations.getAt("test" + db.capitalize())
}
integTestAll {
dependsOn(task)
Expand Down

0 comments on commit 89b7091

Please sign in to comment.