Testclusters: convert ml qa tests (#43229)

* Testclusters: convert ml qa tests

This PR converts the ML tests to use testclusters.
This commit is contained in:
Alpar Torok 2019-06-18 10:10:05 +03:00
parent da97325790
commit 94930d0e84
6 changed files with 42 additions and 54 deletions

View File

@ -1,3 +1,4 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -6,12 +7,13 @@ dependencies {
testCompile project(path: xpackModule('ml'), configuration: 'runtime')
}
integTestCluster {
testClusters.integTest {
distribution = 'DEFAULT'
numberOfNodes = 3
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.ml.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
numNodes = 3
}

View File

@ -1,3 +1,4 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -6,9 +7,9 @@ dependencies {
testCompile project(path: xpackModule('ml'), configuration: 'runtime')
}
integTestCluster {
testClusters.integTest {
distribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
numNodes = 1
}

View File

@ -1,3 +1,4 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -14,7 +15,10 @@ task copyMlRestTests(type: Copy) {
include 'rest-api-spec/test/ml/**'
}
integTestRunner {
integTest.runner {
dependsOn copyMlRestTests
}
integTest.runner {
systemProperty 'tests.rest.blacklist', [
// Remove this test because it doesn't call an ML endpoint and we don't want
// to grant extra permissions to the users used in this test suite
@ -103,27 +107,14 @@ integTestRunner {
].join(',')
}
integTestCluster {
dependsOn copyMlRestTests
extraConfigFile 'roles.yml', 'roles.yml'
setupCommand 'setupTestAdminUser',
'bin/elasticsearch-users', 'useradd', 'x_pack_rest_user', '-p', 'x-pack-test-password', '-r', 'superuser'
setupCommand 'setupMlAdminUser',
'bin/elasticsearch-users', 'useradd', 'ml_admin', '-p', 'x-pack-test-password', '-r', 'minimal,machine_learning_admin'
setupCommand 'setupMlUserUser',
'bin/elasticsearch-users', 'useradd', 'ml_user', '-p', 'x-pack-test-password', '-r', 'minimal,machine_learning_user'
setupCommand 'setupPowerlessUser',
'bin/elasticsearch-users', 'useradd', 'no_ml', '-p', 'x-pack-test-password', '-r', 'minimal'
testClusters.integTest {
distribution = 'DEFAULT'
extraConfigFile 'roles.yml', file('roles.yml')
user username: "x_pack_rest_user", password: "x-pack-test-password"
user username: "ml_admin", password: "x-pack-test-password", role: "minimal,machine_learning_admin"
user username: "ml_user", password: "x-pack-test-password", role: "minimal,machine_learning_user"
user username: "no_ml", password: "x-pack-test-password", role: "minimal"
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.security.enabled', 'true'
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: 'x_pack_rest_user',
password: 'x-pack-test-password',
ignoreerrors: true,
retries: 10)
return tmpFile.exists()
}
}

View File

@ -1,3 +1,4 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -8,14 +9,6 @@ dependencies {
testCompile project(path: xpackModule('ml'), configuration: 'testArtifacts')
}
integTestRunner {
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.
*/
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
// location for keys and certificates
File keystoreDir = new File(project.buildDir, 'keystore')
File nodeKey = file("$keystoreDir/testnode.pem")
@ -31,8 +24,21 @@ task copyKeyCerts(type: Copy) {
sourceSets.test.resources.srcDir(keystoreDir)
processTestResources.dependsOn(copyKeyCerts)
integTestCluster {
integTest {
dependsOn copyKeyCerts
runner {
/*
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
* other if we allow them to set the number of available processors as it's set-once in Netty.
*/
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
}
testClusters.integTest {
numberOfNodes = 3
distribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.ml.enabled', 'true'
setting 'xpack.watcher.enabled', 'false'
@ -47,25 +53,11 @@ integTestCluster {
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.ml.min_disk_space_off_heap', '200mb'
keystoreSetting 'bootstrap.password', 'x-pack-test-password'
keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
keystore 'bootstrap.password', 'x-pack-test-password'
keystore 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
numNodes = 3
setupCommand 'setupDummyUser',
'bin/elasticsearch-users', 'useradd', 'x_pack_rest_user', '-p', 'x-pack-test-password', '-r', 'superuser'
user username: "x_pack_rest_user", password: "x-pack-test-password"
extraConfigFile nodeKey.name, nodeKey
extraConfigFile nodeCert.name, nodeCert
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: 'x_pack_rest_user',
password: 'x-pack-test-password',
ignoreerrors: true,
retries: 10)
return tmpFile.exists()
}
}

View File

@ -3,4 +3,4 @@ apply plugin: 'elasticsearch.standalone-test'
dependencies {
testCompile project(":x-pack:plugin:core")
testCompile project(path: xpackModule('ml'), configuration: 'runtime')
}
}

View File

@ -1,3 +1,4 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
@ -6,7 +7,8 @@ dependencies {
testCompile project(path: xpackModule('ml'), configuration: 'runtime')
}
integTestCluster {
testClusters.integTest {
distribution = 'DEFAULT'
setting 'xpack.ilm.enabled', 'false'
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'