From 11fd96d371d859358f54b8fd28d929aedba6b6d2 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Thu, 23 Jan 2020 14:54:57 -0800 Subject: [PATCH] Always test against default distribution when in a FIPS JVM (#51273) (#51333) --- .../groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 3 +++ plugins/examples/build.gradle | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 1129f29b11cfe..2e4ff69d0e82c 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -34,6 +34,8 @@ import org.elasticsearch.gradle.precommit.PrecommitTasks import org.elasticsearch.gradle.test.ErrorReportingTestListener import org.elasticsearch.gradle.testclusters.ElasticsearchCluster import org.elasticsearch.gradle.testclusters.TestClustersPlugin +import org.elasticsearch.gradle.testclusters.TestDistribution +import org.elasticsearch.gradle.tool.Boilerplate import org.gradle.api.Action import org.gradle.api.GradleException import org.gradle.api.InvalidUserDataException @@ -158,6 +160,7 @@ class BuildPlugin implements Plugin { NamedDomainObjectContainer testClusters = project.extensions.findByName(TestClustersPlugin.EXTENSION_NAME) as NamedDomainObjectContainer if (testClusters != null) { testClusters.all { ElasticsearchCluster cluster -> + cluster.setTestDistribution(TestDistribution.DEFAULT) cluster.systemProperty 'javax.net.ssl.trustStorePassword', 'password' cluster.systemProperty 'javax.net.ssl.keyStorePassword', 'password' // Can't use our DiagnosticTrustManager with SunJSSE in FIPS mode diff --git a/plugins/examples/build.gradle b/plugins/examples/build.gradle index a122058b9a326..770c3cd1d4f94 100644 --- a/plugins/examples/build.gradle +++ b/plugins/examples/build.gradle @@ -1,3 +1,5 @@ +import org.elasticsearch.gradle.info.BuildParams + // Subprojects aren't published so do not assemble gradle.projectsEvaluated { subprojects { @@ -5,6 +7,13 @@ gradle.projectsEvaluated { if (assemble) { assemble.enabled = false } + + // Disable example project testing with FIPS JVM + tasks.withType(Test) { + onlyIf { + BuildParams.inFipsJvm == false + } + } } }