forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces the concept of shared tests clusters using the new JUnit testing framework. Unlike normal test clusters which are exclusive to each test suite (class), shared clusters persist across test suites to be reused. This can be useful for test projects with a large number of test suites that can all use a single cluster, and the overhead of creating these clusters is the dominating factor.
- Loading branch information
1 parent
65f91cf
commit 011ccc8
Showing
29 changed files
with
371 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/framework/src/main/java/org/elasticsearch/test/TestClustersThreadFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.test; | ||
|
||
import com.carrotsearch.randomizedtesting.ThreadFilter; | ||
|
||
/** | ||
* When using shared test clusters we launch processes that persist across test suites. This filter is used to ignore those in that case. | ||
*/ | ||
public class TestClustersThreadFilter implements ThreadFilter { | ||
@Override | ||
public boolean reject(Thread t) { | ||
return t.getName().endsWith("-log-forwarder") || t.getName().contains("node-executor"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 4 additions & 45 deletions
49
x-pack/plugin/eql/qa/multi-cluster-with-security/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,10 @@ | ||
import org.elasticsearch.gradle.testclusters.DefaultTestClustersTask | ||
|
||
apply plugin: 'elasticsearch.legacy-java-rest-test' | ||
apply plugin: 'elasticsearch.internal-java-rest-test' | ||
|
||
dependencies { | ||
javaRestTestImplementation project(path: xpackModule('eql:qa:common')) | ||
} | ||
|
||
def remoteClusterReg = testClusters.register('remote-cluster') { | ||
testDistribution = 'DEFAULT' | ||
numberOfNodes = 2 | ||
setting 'node.roles', '[data,ingest,master]' | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'xpack.watcher.enabled', 'false' | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.security.autoconfiguration.enabled', 'false' | ||
|
||
user username: "test_user", password: "x-pack-test-password" | ||
} | ||
|
||
def integTestClusterReg = testClusters.register('javaRestTest') { | ||
testDistribution = 'DEFAULT' | ||
setting 'xpack.ml.enabled', 'false' | ||
setting 'xpack.watcher.enabled', 'false' | ||
setting 'cluster.remote.my_remote_cluster.seeds', { | ||
remoteClusterReg.get().getAllTransportPortURI().collect { "\"$it\"" }.toString() | ||
} | ||
setting 'cluster.remote.connections_per_cluster', "1" | ||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.security.autoconfiguration.enabled', 'false' | ||
|
||
user username: "test_user", password: "x-pack-test-password" | ||
} | ||
|
||
tasks.register("startRemoteCluster", DefaultTestClustersTask.class) { | ||
useCluster remoteClusterReg | ||
doLast { | ||
"Starting remote cluster before integ tests and integTest cluster is started" | ||
} | ||
} | ||
|
||
tasks.named("javaRestTest").configure { | ||
dependsOn 'startRemoteCluster' | ||
useCluster remoteClusterReg | ||
doFirst { | ||
nonInputProperties.systemProperty 'tests.rest.cluster.remote.host', remoteClusterReg.map(c->c.getAllHttpSocketURI().get(0)) | ||
nonInputProperties.systemProperty 'tests.rest.cluster.remote.user', "test_user" | ||
nonInputProperties.systemProperty 'tests.rest.cluster.remote.password', "x-pack-test-password" | ||
} | ||
tasks.named('javaRestTest') { | ||
usesDefaultDistribution() | ||
maxParallelForks = 1 | ||
} | ||
tasks.named("check").configure {dependsOn("javaRestTest") } // run these tests as part of the "check" task |
Oops, something went wrong.