You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by li...@apache.org on 2022/03/04 13:24:29 UTC

[calcite] 25/41: [CALCITE-5006] Gradle tasks for launching JDBC integration tests are not working

This is an automated email from the ASF dual-hosted git repository.

liyafan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit dc3e7d33ea28aabff43620962f82a52d2fcb0926
Author: Stamatis Zampetakis <za...@gmail.com>
AuthorDate: Wed Feb 9 17:30:09 2022 +0100

    [CALCITE-5006] Gradle tasks for launching JDBC integration tests are 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/calcite#2716
---
 core/build.gradle.kts | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index 093cd79..8b6499e 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -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)
@@ -258,8 +262,6 @@ 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
@@ -267,8 +269,9 @@ for (db in listOf("h2", "mysql", "oracle", "postgresql")) {
         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)