@@ -29,6 +29,8 @@ esplugin {
2929 classname ' org.elasticsearch.repositories.hdfs.HdfsPlugin'
3030}
3131
32+ apply plugin : ' elasticsearch.vagrantsupport'
33+
3234versions << [
3335 ' hadoop2' : ' 2.8.1'
3436]
@@ -85,6 +87,7 @@ task krb5kdcUpdate(type: org.elasticsearch.gradle.vagrant.VagrantCommandTask) {
8587 subcommand ' update'
8688 boxName box
8789 environmentVars vagrantEnvVars
90+ dependsOn " vagrantCheckVersion" , " virtualboxCheckVersion"
8891}
8992
9093task krb5kdcFixture (type : org.elasticsearch.gradle.test.VagrantFixture ) {
@@ -135,7 +138,7 @@ task secureHdfsFixture(type: org.elasticsearch.gradle.test.AntFixture) {
135138 args miniHDFSArgs. toArray()
136139}
137140
138- boolean fixtureSupported = false ;
141+ boolean fixtureSupported = false
139142if (Os . isFamily(Os . FAMILY_WINDOWS )) {
140143 // hdfs fixture will not start without hadoop native libraries on windows
141144 String nativePath = System . getenv(" HADOOP_HOME" )
@@ -163,48 +166,25 @@ if (fixtureSupported) {
163166 integTestRunner. systemProperty ' tests.rest.suite' , ' hdfs_repository/10_basic'
164167}
165168
166- boolean secureFixtureSupported = false ;
169+ boolean secureFixtureSupported = false
167170if (fixtureSupported) {
168- // Only do secure fixture support if the regular fixture is supported,
169- // and if vagrant is installed. The ignoreExitValue on exec only matters
170- // in cases where the command can be found and successfully started. In
171- // situations where the vagrant command isn't able to be started at all
172- // (it's not installed) then Gradle still throws ExecException.
173- ByteArrayOutputStream pipe = new ByteArrayOutputStream ()
174- try {
175- ExecResult runResult = exec {
176- commandLine ' vagrant' , ' --version'
177- standardOutput pipe
178- ignoreExitValue true
179- }
180- String output = pipe. toString(). trim()
181- if (runResult. exitValue == 0 ) {
182- secureFixtureSupported = (output ==~ / Vagrant 1\. (8\. [6-9]|9\. [0-9])+/ )
183- } else {
184- logger. warn(" Could not read installed vagrant version:\n " + output)
185- }
186- } catch (org.gradle.process.internal.ExecException e) {
187- logger. warn(" Could not find vagrant: " + e. message)
188- // Swallow error. Vagrant isn't installed. Leave secure fixture support off.
189- }
171+ secureFixtureSupported = project. rootProject. vagrantSupported
190172}
191173
192174// Create a Integration Test suite just for security based tests
193- if (secureFixtureSupported && false ) { // This fails due to a vagrant configuration issue - remove the false check to re-enable
194- // This must execute before the afterEvaluate block from integTestSecure
195- project. afterEvaluate {
196- Path elasticsearchKT = project(' :test:fixtures:krb5kdc-fixture' ). buildDir. toPath(). resolve(" keytabs" ). resolve(" elasticsearch.keytab" ). toAbsolutePath()
197- Path krb5conf = project(' :test:fixtures:krb5kdc-fixture' ). buildDir. toPath(). resolve(" conf" ). resolve(" krb5.conf" ). toAbsolutePath()
175+ // This must execute before the afterEvaluate block from integTestSecure
176+ project. afterEvaluate {
177+ Path elasticsearchKT = project(' :test:fixtures:krb5kdc-fixture' ). buildDir. toPath(). resolve(" keytabs" ). resolve(" elasticsearch.keytab" ). toAbsolutePath()
178+ Path krb5conf = project(' :test:fixtures:krb5kdc-fixture' ). buildDir. toPath(). resolve(" conf" ). resolve(" krb5.conf" ). toAbsolutePath()
198179
199180 project. integTestSecureCluster. dependsOn(project. bundlePlugin)
200181 project. integTestSecure. clusterConfig. plugin(project. path)
201182 project. integTestSecure. clusterConfig. extraConfigFile(" repository-hdfs/krb5.keytab" , " ${ elasticsearchKT} " )
202-
203183 final String baseJvmArgs = " -Xms" + System . getProperty(' tests.heap.size' , ' 512m' ) +
204184 " " + " -Xmx" + System . getProperty(' tests.heap.size' , ' 512m' ) +
205185 " " + " -Djava.security.krb5.conf=${ krb5conf} " +
206186 " " + System . getProperty(' tests.jvm.argline' , ' ' )
207- final String jvmArgs
187+ final String jvmArgs
208188 if (project. rootProject. ext. javaVersion == JavaVersion . VERSION_1_9 ) {
209189 jvmArgs = baseJvmArgs + " " + ' --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED'
210190 } else {
@@ -214,18 +194,18 @@ if (secureFixtureSupported && false) { // This fails due to a vagrant configurat
214194 project. integTestSecure. clusterConfig. jvmArgs = jvmArgs
215195 }
216196
217- RestIntegTestTask integTestSecure = project. tasks. create(' integTestSecure' , RestIntegTestTask . class) {
218- description = " Runs rest tests against an elasticsearch cluster with HDFS secured by MIT Kerberos."
219- }
197+ RestIntegTestTask integTestSecure = project. tasks. create(' integTestSecure' , RestIntegTestTask . class) {
198+ description = " Runs rest tests against an elasticsearch cluster with HDFS secured by MIT Kerberos."
199+ }
220200
221- integTestSecure . mustRunAfter(project . integTest)
201+ if (secureFixtureSupported) {
222202 project. check. dependsOn(integTestSecure)
223203
224204 // Fixture dependencies
225205 integTestSecureCluster. dependsOn secureHdfsFixture, krb5kdcFixture
226206 integTestSecureRunner. systemProperty ' tests.rest.suite' , ' secure_hdfs_repository'
227207} else {
228- logger . warn( " secured hdfsFixture is unsupported, please install Vagrant 1.8.6+ to enable " )
208+ integTestSecure . enabled = false
229209}
230210
231211thirdPartyAudit. excludes = [
0 commit comments