blob: 711e09d0e3cd3bbeade24c89390c77f8e5197c3b [file] [log] [blame]
import java.nio.file.Paths
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
project(':cassandra-analytics-integration-tests') {
apply(plugin: 'java-library')
def integrationMaxHeapSize = System.getenv("INTEGRATION_MAX_HEAP_SIZE") ?: "3000M"
println("Using ${integrationMaxHeapSize} maxHeapSize")
def integrationMaxParallelForks = (System.getenv("INTEGRATION_MAX_PARALLEL_FORKS") ?: "4") as int
println("Using ${integrationMaxParallelForks} maxParallelForks")
configurations {
all*.exclude(group: 'org.slf4j', module: 'slf4j-log4j12')
all*.exclude(group: 'log4j', module: 'log4j')
}
dependencies {
testImplementation(project(':cassandra-analytics-core'))
testImplementation(group: 'net.java.dev.jna', name: 'jna', version: '5.9.0')
testImplementation(group: "${sparkGroupId}", name: "spark-core_${scalaMajorVersion}", version: "${sparkVersion}")
testImplementation(group: "${sparkGroupId}", name: "spark-sql_${scalaMajorVersion}", version: "${sparkVersion}")
testImplementation(group: "${sidecarClientGroup}", name: "${sidecarClientName}", version: "${sidecarVersion}")
// JUnit
testImplementation("org.junit.jupiter:junit-jupiter-api:${project.junitVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${project.junitVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-engine:${project.junitVersion}")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation(project(path: ":cassandra-analytics-integration-framework", configuration: "shadow"))
ext.dtestJar = System.getenv("DTEST_JAR") ?: "dtest-4.1.4.jar" // latest supported Cassandra build is 4.1
def dtestJarFullPath = "${dependencyLocation}${ext.dtestJar}"
println("Using DTest jar: " + dtestJarFullPath)
testCompileOnly(files("${dtestJarFullPath}"))
testImplementation("org.apache.cassandra:dtest-api:0.0.16")
// Needed by the Cassandra dtest framework
testImplementation("org.junit.vintage:junit-vintage-engine:${junitVersion}")
testImplementation('com.datastax.cassandra:cassandra-driver-core:3.9.0')
testImplementation('org.mockito:mockito-inline:4.10.0')
testImplementation("org.assertj:assertj-core:3.24.2")
// Logging
testImplementation(group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.22.0')
testImplementation(group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.22.0')
testImplementation(group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.22.0')
testImplementation(group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.22.0')
}
test {
// Because system properties aren't passed from the command line through to tests, we need to specifically
// set them again here.
systemProperty "cassandra.test.dtest_jar_path", dependencyLocation
systemProperty "cassandra.sidecar.versions_to_test",
System.getProperty("cassandra.sidecar.versions_to_test", "4.1")
systemProperty "SKIP_STARTUP_VALIDATIONS", "true"
systemProperty "logback.configurationFile", "src/test/resources/logback-test.xml"
minHeapSize = '1g'
maxHeapSize = integrationMaxHeapSize
maxParallelForks = integrationMaxParallelForks
forkEvery = 1 // Enables different end-to-end test classes use Spark contexts with different configurations
beforeTest {descriptor ->
// println("Setting test tags to ${descriptor.className}-${descriptor.name}")
systemProperty "cassandra.testtag", "${descriptor.className}"
systemProperty "suitename", "${descriptor.name}"
}
testLogging {
events "passed", "skipped", "failed"
}
// Make it so unit tests run on a jar with Cassandra bridge implementations built in
dependsOn(tasks.jar)
classpath = project.sourceSets.test.output + configurations.testRuntimeClasspath + files(jar.archiveFile)
useJUnitPlatform()
def destDir = Paths.get(rootProject.rootDir.absolutePath, "build", "test-reports", "integration").toFile()
reports {
junitXml {
enabled true
destination = destDir
}
html {
enabled true
destination = destDir
}
}
}
}