100 lines
3.2 KiB
Groovy
100 lines
3.2 KiB
Groovy
import org.elasticsearch.gradle.BwcVersions.UnreleasedVersionInfo
|
|
import org.elasticsearch.gradle.Version
|
|
import org.elasticsearch.gradle.VersionProperties
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
|
|
description = 'Integration tests for SQL JDBC driver'
|
|
apply plugin: 'elasticsearch.java'
|
|
|
|
// Avoid circular dependency
|
|
group = 'org.elasticsearch.x-pack.qa.sql.jdbc'
|
|
|
|
dependencies {
|
|
api project(':test:framework')
|
|
implementation xpackProject('plugin:sql:sql-proto')
|
|
|
|
// Actual tests will use the shadow jar
|
|
compileOnly(project(path: xpackModule('sql:jdbc'))) {
|
|
// Since dependencies will be relocated in the shadow jar, don't attempt to compile against them
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
// disable unit tests because these are all integration tests used other qa projects
|
|
test.enabled = false
|
|
|
|
subprojects {
|
|
if (subprojects.isEmpty()) {
|
|
// leaf project
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
apply from: "$rootDir/gradle/bwc-test.gradle"
|
|
} else {
|
|
apply plugin: 'elasticsearch.java'
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
// Repository for downloading BWC compatible JDBC driver releases
|
|
url = 'https://artifacts.elastic.co/maven'
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
jdbcDriver
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation(xpackProject('plugin:sql:qa:jdbc'))
|
|
|
|
// We use the shadowjar for testing since that's the actual artifact we deliver to users
|
|
testCompileOnly project(path: xpackModule('sql:jdbc'), configuration: 'shadow')
|
|
jdbcDriver project(path: xpackModule('sql:jdbc'), configuration: 'shadow')
|
|
}
|
|
|
|
if (project.name != 'security') {
|
|
// The security project just configures its subprojects
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
testClusters.all {
|
|
testDistribution = 'DEFAULT'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
setting 'xpack.watcher.enabled', 'false'
|
|
}
|
|
|
|
integTest {
|
|
classpath += configurations.jdbcDriver
|
|
systemProperty 'jdbc.driver.version', VersionProperties.elasticsearch
|
|
}
|
|
|
|
// Configure compatibility testing tasks
|
|
for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
|
|
// Compatibility testing for JDBC driver started with version 7.9.0
|
|
if (bwcVersion.onOrAfter(Version.fromString("7.9.0"))) {
|
|
String baseName = "v${bwcVersion}"
|
|
UnreleasedVersionInfo unreleasedVersion = BuildParams.bwcVersions.unreleasedInfo(bwcVersion)
|
|
Configuration driverConfiguration = configurations.create("jdbcDriver${baseName}")
|
|
Object driverDependency = null
|
|
|
|
if (unreleasedVersion) {
|
|
// For unreleased snapshot versions, build them from source
|
|
driverDependency = files(project(unreleasedVersion.gradleProjectPath).tasks.named('buildBwcJdbc'))
|
|
} else {
|
|
// For released versions, download it
|
|
driverDependency = "org.elasticsearch.plugin:x-pack-sql-jdbc:${bwcVersion}"
|
|
}
|
|
|
|
dependencies {
|
|
"jdbcDriver${baseName}"(driverDependency)
|
|
}
|
|
|
|
tasks.create(bwcTaskName(bwcVersion), RestIntegTestTask) {
|
|
classpath += driverConfiguration
|
|
systemProperty 'jdbc.driver.version', bwcVersion.toString()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|