Skip to content

Commit

Permalink
cleanup ILM qa structure (#35110)
Browse files Browse the repository at this point in the history
This commit does a few things

- moves ILM-specifc rest yaml tests into plugin/ilm/qa, and creates special
  :plugin:ilm:qa:rest module to test them
- removes the with-security tests of the yaml tests since they are covered in
  the rest tests now
- moves ChangePolicyforIndexIT into the qa/multi-node project since that test is
  not currently running in main ilm since integTest is disabled
  • Loading branch information
talevy authored Oct 31, 2018
1 parent a294a7c commit 5f4b23f
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 14 deletions.
10 changes: 8 additions & 2 deletions x-pack/plugin/ilm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ dependencies {
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
}

check.dependsOn 'qa:with-security:integTestRunner'
check.dependsOn 'qa:multi-node:integTestRunner'
// add all sub-projects of the qa sub-project
gradle.projectsEvaluated {
project.subprojects
.find { it.path == project.path + ":qa" }
.subprojects
.findAll { it.path.startsWith(project.path + ":qa") }
.each { check.dependsOn it.check }
}

integTest.enabled = false

Expand Down
20 changes: 20 additions & 0 deletions x-pack/plugin/ilm/qa/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
import org.elasticsearch.gradle.test.RestIntegTestTask

apply plugin: 'elasticsearch.build'
test.enabled = false

dependencies {
compile project(':test:framework')
}

subprojects {
project.tasks.withType(RestIntegTestTask) {
final File xPackResources = new File(xpackProject('plugin').projectDir, 'src/test/resources')
project.copyRestSpec.from(xPackResources) {
include 'rest-api-spec/api/**'
}
}
}

/* Remove assemble on all qa projects because we don't need to publish
* artifacts for them. */
gradle.projectsEvaluated {
Expand All @@ -9,3 +27,5 @@ gradle.projectsEvaluated {
}
}

// the qa modules does not have any source files
licenseHeaders.enabled = false
45 changes: 45 additions & 0 deletions x-pack/plugin/ilm/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import org.elasticsearch.gradle.test.RestIntegTestTask

apply plugin: 'elasticsearch.standalone-test'

dependencies {
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
testCompile project(path: xpackModule('ilm'), configuration: 'runtime')
}

task restTest(type: RestIntegTestTask) {
mustRunAfter(precommit)
}

def clusterCredentials = [username: System.getProperty('tests.rest.cluster.username', 'test_admin'),
password: System.getProperty('tests.rest.cluster.password', 'x-pack-test-password')]


restTestRunner {
systemProperty 'tests.rest.cluster.username', clusterCredentials.username
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}

restTestCluster {
distribution 'zip'
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setup-admin-user',
'bin/elasticsearch-users', 'useradd', clusterCredentials.username, '-p', clusterCredentials.password, '-r', 'superuser'
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
dest: tmpFile.toString(),
username: clusterCredentials.username,
password: clusterCredentials.password,
ignoreerrors: true,
retries: 10)
return tmpFile.exists()
}
}

check.dependsOn restTest
test.enabled = false
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

package org.elasticsearch.xpack.security;
package org.elasticsearch.xpack.indexlifecycle;

import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
Expand All @@ -21,12 +21,12 @@
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;

@TimeoutSuite(millis = 30 * TimeUnits.MINUTE) // as default timeout seems not enough on the jenkins VMs
public class IndexLifecycleWithSecurityClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
public class IndexLifecycleRestIT extends ESClientYamlSuiteTestCase {

private static final String USER = Objects.requireNonNull(System.getProperty("tests.rest.cluster.username"));
private static final String PASS = Objects.requireNonNull(System.getProperty("tests.rest.cluster.password"));

public IndexLifecycleWithSecurityClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
public IndexLifecycleRestIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}

Expand Down
9 changes: 0 additions & 9 deletions x-pack/plugin/ilm/qa/with-security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ dependencies {
testCompile project(path: xpackProject('plugin').path, configuration: 'testArtifacts')
}

// bring in ILM rest test suite
task copyILMRestTests(type: Copy) {
into project.sourceSets.test.output.resourcesDir
from xpackProject('plugin').sourceSets.test.resources.srcDirs
include 'rest-api-spec/api/ilm.*'
include 'rest-api-spec/test/ilm/**'
}

def clusterCredentials = [username: System.getProperty('tests.rest.cluster.username', 'test_admin'),
password: System.getProperty('tests.rest.cluster.password', 'x-pack-test-password')]

Expand All @@ -22,7 +14,6 @@ integTestRunner {
}

integTestCluster {
dependsOn copyILMRestTests
setting 'xpack.ilm.enabled', 'true'
setting 'xpack.security.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
Expand Down

0 comments on commit 5f4b23f

Please sign in to comment.