-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: [Tests] Move JDBC integration tests to new module (#56872)
Move the JDBC functionality integration tests from `:sql:qa` to a separate module `:sql:qa:jdbc`. This way the tests are isolated from the rest of the integration tests and they only depend to the `:sql:jdbc` module, thus removing the danger of accidentally pulling in some dependency that may hide bugs. Moreover this is a preparation for #56722, so that we can run those tests between different JDBC and ES node versions and ensure forward compatibility. Move the rest of existing tests inside a new `:sql:qa:server` project, so that the `:sql:qa` becomes the parent project for both and one can run all the integration tests by using this parent project.
- Loading branch information
Showing
202 changed files
with
4,295 additions
and
2,840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1 @@ | ||
description = 'Integration tests for SQL' | ||
apply plugin: 'elasticsearch.build' | ||
archivesBaseName = 'qa-sql' | ||
group = "org.elasticsearch.x-pack.qa.sql" | ||
|
||
dependencies { | ||
compile project(":test:framework") | ||
|
||
// JDBC testing dependencies | ||
compile project(path: xpackModule('sql:jdbc')) | ||
|
||
compile "net.sourceforge.csvjdbc:csvjdbc:${csvjdbcVersion}" | ||
|
||
// CLI testing dependencies | ||
compile project(path: xpackModule('sql:sql-cli')) | ||
|
||
// H2GIS testing dependencies | ||
compile("org.orbisgis:h2gis:${h2gisVersion}") { | ||
exclude group: "org.locationtech.jts" | ||
} | ||
|
||
// select just the parts of JLine that are needed | ||
compile("org.jline:jline-terminal-jna:${jlineVersion}") { | ||
exclude group: "net.java.dev.jna" | ||
} | ||
compile "org.jline:jline-terminal:${jlineVersion}" | ||
compile "org.jline:jline-reader:${jlineVersion}" | ||
compile "org.jline:jline-style:${jlineVersion}" | ||
|
||
testRuntime "org.elasticsearch:jna:${versions.jna}" | ||
} | ||
|
||
/* disable unit tests because these are all integration tests used | ||
* other qa projects. */ | ||
test.enabled = false | ||
|
||
dependencyLicenses.enabled = false | ||
dependenciesInfo.enabled = false | ||
|
||
// the main files are actually test files, so use the appropriate forbidden api sigs | ||
tasks.named('forbiddenApisMain').configure { | ||
replaceSignatureFiles 'es-all-signatures', 'es-test-signatures' | ||
} | ||
|
||
// just a test fixture: we aren't using this jars in releases and H2GIS requires disabling a lot of checks | ||
thirdPartyAudit.enabled = false | ||
|
||
subprojects { | ||
if (subprojects.isEmpty()) { | ||
// leaf project | ||
apply plugin: 'elasticsearch.standalone-rest-test' | ||
} else { | ||
apply plugin: 'elasticsearch.build' | ||
} | ||
|
||
configurations.testRuntimeClasspath { | ||
resolutionStrategy.force "org.slf4j:slf4j-api:1.7.25" | ||
} | ||
configurations.testRuntime { | ||
// This is also required to make resolveAllDependencies work | ||
resolutionStrategy.force "org.slf4j:slf4j-api:1.7.25" | ||
} | ||
dependencies { | ||
|
||
/* Since we're a standalone rest test we actually get transitive | ||
* dependencies but we don't really want them because they cause | ||
* all kinds of trouble with the jar hell checks. So we suppress | ||
* them explicitly for non-es projects. */ | ||
testCompile(xpackProject('plugin:sql:qa')) { | ||
transitive = false | ||
} | ||
testCompile project(":test:framework") | ||
|
||
// JDBC testing dependencies | ||
testRuntime "net.sourceforge.csvjdbc:csvjdbc:${csvjdbcVersion}" | ||
testRuntime "com.h2database:h2:${h2Version}" | ||
|
||
// H2GIS testing dependencies | ||
testRuntime("org.orbisgis:h2gis:${h2gisVersion}") { | ||
exclude group: "org.locationtech.jts" | ||
exclude group: "com.fasterxml.jackson.core" | ||
} | ||
|
||
testRuntime project(path: xpackModule('sql:jdbc')) | ||
testRuntime xpackProject('plugin:sql:sql-client') | ||
|
||
// TODO check if needed | ||
testRuntime("org.antlr:antlr4-runtime:${antlrVersion}") { | ||
transitive = false | ||
} | ||
|
||
// CLI testing dependencies | ||
testRuntime project(path: xpackModule('sql:sql-cli')) | ||
testRuntime(xpackProject('plugin:sql:sql-action')) { | ||
transitive = false | ||
} | ||
|
||
testRuntime("org.jline:jline-terminal-jna:${jlineVersion}") { | ||
exclude group: "net.java.dev.jna" | ||
} | ||
testRuntime "org.jline:jline-terminal:${jlineVersion}" | ||
testRuntime "org.jline:jline-reader:${jlineVersion}" | ||
testRuntime "org.jline:jline-style:${jlineVersion}" | ||
|
||
testRuntime "org.elasticsearch:jna:${versions.jna}" | ||
|
||
// spatial dependency | ||
testRuntime project(path: xpackModule('spatial')) | ||
} | ||
|
||
if (project.name != 'security') { | ||
// The security project just configures its subprojects | ||
apply plugin: 'elasticsearch.testclusters' | ||
apply plugin: 'elasticsearch.rest-test' | ||
|
||
testClusters.integTest { | ||
testDistribution = 'DEFAULT' | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'xpack.watcher.enabled', 'false' | ||
} | ||
|
||
task runqa { | ||
doFirst { | ||
println "Run with `-Dtestclusters.inspect.failure=true integTest` to leave the cluster running after failure" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
description = 'Integration tests for SQL JDBC driver' | ||
apply plugin: 'elasticsearch.build' | ||
|
||
// Avoid circular dependency | ||
group = "org.elasticsearch.x-pack.qa.sql.jdbc" | ||
|
||
dependencies { | ||
compile project(":test:framework") | ||
|
||
// JDBC testing dependencies | ||
compile project(path: xpackModule('sql:jdbc')) | ||
} | ||
|
||
/* disable unit tests because these are all integration tests used | ||
* other qa projects. */ | ||
test.enabled = false | ||
|
||
dependencyLicenses.enabled = false | ||
dependenciesInfo.enabled = false | ||
|
||
// the main files are actually test files, so use the appropriate forbidden api sigs | ||
tasks.named('forbiddenApisMain').configure { | ||
replaceSignatureFiles 'es-all-signatures', 'es-test-signatures' | ||
} | ||
|
||
// just a test fixture: we aren't using this jars in releases and H2GIS requires disabling a lot of checks | ||
thirdPartyAudit.enabled = false | ||
|
||
subprojects { | ||
if (subprojects.isEmpty()) { | ||
// leaf project | ||
apply plugin: 'elasticsearch.standalone-rest-test' | ||
} else { | ||
apply plugin: 'elasticsearch.build' | ||
} | ||
|
||
dependencies { | ||
/* Since we're a standalone rest test we actually get transitive | ||
* dependencies but we don't really want them because they cause | ||
* all kinds of trouble with the jar hell checks. So we suppress | ||
* them explicitly for non-es projects. */ | ||
testCompile(xpackProject('plugin:sql:qa:jdbc')) { | ||
transitive = false | ||
} | ||
testCompile project(":test:framework") | ||
|
||
testRuntime project(path: xpackModule('sql:jdbc')) | ||
} | ||
|
||
if (project.name != 'security') { | ||
// The security project just configures its subprojects | ||
apply plugin: 'elasticsearch.testclusters' | ||
apply plugin: 'elasticsearch.rest-test' | ||
|
||
testClusters.integTest { | ||
testDistribution = 'DEFAULT' | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'xpack.watcher.enabled', 'false' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
description = 'Run SQL JDBC tests against multiple nodes' | ||
|
||
testClusters.integTest { | ||
numberOfNodes = 2 | ||
setting 'xpack.security.enabled', 'false' | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...i-node/src/test/java/org/elasticsearch/xpack/sql/qa/jdbc/multi_node/JdbcJdbcErrorsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.sql.qa.jdbc.multi_node; | ||
|
||
import org.elasticsearch.xpack.sql.qa.jdbc.JdbcErrorsTestCase; | ||
|
||
public class JdbcJdbcErrorsIT extends JdbcErrorsTestCase {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testClusters.integTest { | ||
setting 'xpack.security.enabled', 'false' | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
dependencies { | ||
testCompile project(':x-pack:plugin:core') | ||
} | ||
|
||
Project mainProject = project | ||
|
||
configurations.create('testArtifacts') | ||
|
||
TaskProvider testJar = tasks.register("testJar", Jar) { | ||
appendix 'test' | ||
from sourceSets.test.output | ||
} | ||
|
||
artifacts { | ||
testArtifacts testJar | ||
} | ||
|
||
// Tests are pushed down to subprojects and will be checked there. | ||
testingConventions.enabled = false | ||
|
||
subprojects { | ||
// Use tests from the root security qa project in subprojects | ||
configurations.create('testArtifacts') | ||
|
||
dependencies { | ||
testCompile project(":x-pack:plugin:core") | ||
testArtifacts project(path: mainProject.path, configuration: 'testArtifacts') | ||
} | ||
|
||
testClusters.integTest { | ||
testDistribution = 'DEFAULT' | ||
// Setup auditing so we can use it in some tests | ||
setting 'xpack.security.audit.enabled', 'true' | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.license.self_generated.type', 'trial' | ||
// Setup roles used by tests | ||
extraConfigFile 'roles.yml', mainProject.file('roles.yml') | ||
/* Setup the one admin user that we run the tests as. | ||
* Tests use "run as" to get different users. */ | ||
user username: "test_admin", password: "x-pack-test-password" | ||
} | ||
|
||
File testArtifactsDir = project.file("$buildDir/testArtifacts") | ||
TaskProvider copyTestClasses = tasks.register("copyTestClasses", Copy) { | ||
dependsOn configurations.testArtifacts | ||
from { zipTree(configurations.testArtifacts.singleFile) } | ||
into testArtifactsDir | ||
} | ||
|
||
integTest.runner { | ||
dependsOn copyTestClasses | ||
testClassesDirs += project.files(testArtifactsDir) | ||
classpath += configurations.testArtifacts | ||
nonInputProperties.systemProperty 'tests.audit.logfile', | ||
"${-> testClusters.integTest.singleNode().getAuditLog()}" | ||
nonInputProperties.systemProperty 'tests.audit.yesterday.logfile', | ||
"${-> testClusters.integTest.singleNode().getAuditLog().getParentFile()}/integTest_audit-${new Date().format('yyyy-MM-dd')}.json" | ||
} | ||
|
||
testingConventions.enabled = false | ||
} |
File renamed without changes.
Oops, something went wrong.