| 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. |
| */ |
| |
| plugins { |
| id('idea') |
| // A Java library |
| id('java-library') |
| // which is published |
| id('maven-publish') |
| } |
| |
| publishing { |
| publications { |
| maven(MavenPublication) { |
| from components.java |
| groupId project.group |
| artifactId "${archivesBaseName}" |
| version System.getenv("CODE_VERSION") ?: "${version}" |
| } |
| } |
| } |
| |
| 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") |
| |
| def integrationEnableMtls = (System.getenv("INTEGRATION_MTLS_ENABLED") ?: "true") as boolean |
| println("Using mTLS for tests? ${integrationEnableMtls}") |
| |
| configurations { |
| // remove netty-all dependency coming from spark |
| all*.exclude(group: 'io.netty', module: 'netty-all') |
| configureEach { |
| resolutionStrategy { |
| // Force set the vertx versions that do not depend on a newer jackson version |
| force("io.vertx:vertx-web:${vertxVersion}") |
| force("io.vertx:vertx-core:${vertxVersion}") |
| force("io.vertx:vertx-auth-common:${vertxVersion}") |
| force("io.vertx:vertx-dropwizard-metrics:${vertxVersion}") |
| force("io.vertx:vertx-web-client:${vertxVersion}") |
| } |
| } |
| } |
| |
| 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(project(path: ":cassandra-analytics-integration-framework")) |
| |
| testImplementation 'software.amazon.awssdk:s3' |
| testImplementation 'software.amazon.awssdk:netty-nio-client' |
| testImplementation platform(group: 'software.amazon.awssdk', name:'bom', version:"${project.aswSdkVersion}") |
| testImplementation 'com.adobe.testing:s3mock-testcontainers:2.17.0' // 3.x version do not support java 11 |
| |
| testRuntimeOnly 'com.fasterxml.jackson.core:jackson-annotations:2.14.2' |
| } |
| |
| 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" |
| systemProperty "cassandra.integration.sidecar.test.enable_mtls", integrationEnableMtls |
| 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" |
| } |
| |
| if (JavaVersion.current().isJava11Compatible()) { |
| def JDK11_OPTIONS = ['-Djdk.attach.allowAttachSelf=true', |
| '--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED', |
| '--add-exports', 'java.base/jdk.internal.ref=ALL-UNNAMED', |
| '--add-exports', 'java.base/sun.nio.ch=ALL-UNNAMED', |
| '--add-exports', 'java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED', |
| '--add-exports', 'java.rmi/sun.rmi.registry=ALL-UNNAMED', |
| '--add-exports', 'java.rmi/sun.rmi.server=ALL-UNNAMED', |
| '--add-exports', 'java.sql/java.sql=ALL-UNNAMED', |
| '--add-opens', 'java.base/java.lang.module=ALL-UNNAMED', |
| '--add-opens', 'java.base/jdk.internal.loader=ALL-UNNAMED', |
| '--add-opens', 'java.base/jdk.internal.ref=ALL-UNNAMED', |
| '--add-opens', 'java.base/jdk.internal.reflect=ALL-UNNAMED', |
| '--add-opens', 'java.base/jdk.internal.math=ALL-UNNAMED', |
| '--add-opens', 'java.base/jdk.internal.module=ALL-UNNAMED', |
| '--add-opens', 'java.base/jdk.internal.util.jar=ALL-UNNAMED', |
| '--add-opens', 'jdk.management/com.sun.management.internal=ALL-UNNAMED'] |
| jvmArgs(JDK11_OPTIONS) |
| println("JVM arguments for $project.name are $allJvmArgs") |
| } |
| |
| // container test does not run on java 8 |
| if ("true" == System.getenv("skipContainerTest") || JavaVersion.current().isJava8()) { |
| exclude("**/testcontainer/**") |
| |
| filter { |
| setFailOnNoMatchingTests(false) // do not fail the build if no matching test found, since in CI we run individual test class |
| } |
| } |
| |
| useJUnitPlatform() |
| def destDir = Paths.get(rootProject.rootDir.absolutePath, "build", "test-reports", "integration").toFile() |
| reports { |
| junitXml { |
| enabled true |
| destination = destDir |
| } |
| html { |
| enabled true |
| destination = destDir |
| } |
| } |
| } |
| |
| java { |
| // Allows publishing the test jar |
| registerFeature("test") { |
| usingSourceSet(sourceSets.test) |
| } |
| } |