Testclusters: convert left-overs from checkPart1 (#43370)
* Testclusters: convert left-overs from checkPart1
This commit is contained in:
parent
63fef5a31e
commit
a38f509284
|
@ -217,11 +217,19 @@ public class ElasticsearchCluster implements TestClusterConfiguration {
|
|||
|
||||
@Override
|
||||
public void start() {
|
||||
String nodeNames = nodes.stream().map(ElasticsearchNode::getName).collect(Collectors.joining(","));
|
||||
final String nodeNames;
|
||||
if (nodes.stream().map(ElasticsearchNode::getName).anyMatch( name -> name == null)) {
|
||||
nodeNames = null;
|
||||
} else {
|
||||
nodeNames = nodes.stream().map(ElasticsearchNode::getName).collect(Collectors.joining(","));
|
||||
};
|
||||
for (ElasticsearchNode node : nodes) {
|
||||
if (Version.fromString(node.getVersion()).getMajor() >= 7) {
|
||||
node.defaultConfig.put("cluster.initial_master_nodes", "[" + nodeNames + "]");
|
||||
node.defaultConfig.put("discovery.seed_providers", "file");
|
||||
if (nodeNames != null) {
|
||||
// Can only configure master nodes if we have node names defined
|
||||
if (Version.fromString(node.getVersion()).getMajor() >= 7) {
|
||||
node.defaultConfig.put("cluster.initial_master_nodes", "[" + nodeNames + "]");
|
||||
node.defaultConfig.put("discovery.seed_providers", "file");
|
||||
}
|
||||
}
|
||||
node.start();
|
||||
}
|
||||
|
|
|
@ -732,7 +732,10 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
|||
}
|
||||
|
||||
private void createConfiguration() {
|
||||
defaultConfig.put("node.name", nameCustomization.apply(safeName(name)));
|
||||
String nodeName = nameCustomization.apply(safeName(name));
|
||||
if (nodeName != null) {
|
||||
defaultConfig.put("node.name", nodeName);
|
||||
}
|
||||
defaultConfig.put("path.repo", confPathRepo.toAbsolutePath().toString());
|
||||
defaultConfig.put("path.data", confPathData.toAbsolutePath().toString());
|
||||
defaultConfig.put("path.logs", confPathLogs.toAbsolutePath().toString());
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
|
||||
|
||||
subprojects { Project subproj ->
|
||||
subproj.tasks.withType(RestIntegTestTask) {
|
||||
subproj.extensions.configure("${it.name}Cluster") { cluster ->
|
||||
cluster.distribution = System.getProperty('tests.distribution', 'oss')
|
||||
if (cluster.distribution == 'default') {
|
||||
/*
|
||||
* Add Elastic's repositories so we can resolve older versions of the
|
||||
* default distribution. Those aren't in maven central.
|
||||
*/
|
||||
repositories {
|
||||
maven {
|
||||
name "elastic"
|
||||
url "https://artifacts.elastic.co/maven"
|
||||
}
|
||||
maven {
|
||||
name "elastic-snapshots"
|
||||
url "https://snapshots.elastic.co/maven"
|
||||
}
|
||||
}
|
||||
if (subproj.extensions.findByName("${it.name}Cluster")) {
|
||||
subproj.extensions.configure("${it.name}Cluster") { cluster ->
|
||||
cluster.distribution = System.getProperty('tests.distribution', 'oss')
|
||||
}
|
||||
}
|
||||
}
|
||||
plugins.withType(TestClustersPlugin).whenPluginAdded {
|
||||
afterEvaluate {
|
||||
// We need to delay this so it's not overwritten in RestIntegTestTask
|
||||
testClusters.all {
|
||||
distribution = System.getProperty('tests.distribution', 'oss').toUpperCase()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,22 +17,22 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
integTestCluster {
|
||||
testClusters.integTest {
|
||||
/**
|
||||
* Provide a custom log4j configuration where layout is an old style pattern and confirm that Elasticsearch
|
||||
* can successfully startup.
|
||||
*/
|
||||
extraConfigFile 'log4j2.properties', 'custom-log4j2.properties'
|
||||
extraConfigFile 'log4j2.properties', file('custom-log4j2.properties')
|
||||
}
|
||||
|
||||
integTestRunner {
|
||||
integTest.runner {
|
||||
nonInputProperties.systemProperty 'tests.logfile',
|
||||
"${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }_server.log"
|
||||
"${ -> testClusters.integTest.singleNode().getServerLog().absolutePath.replaceAll(".json", ".log")}"
|
||||
}
|
||||
|
||||
test {
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.List;
|
|||
* The intention is to confirm that users can still run their Elasticsearch instances with previous configurations.
|
||||
*/
|
||||
public class CustomLoggingConfigIT extends ESRestTestCase {
|
||||
private static final String NODE_STARTED = ".*node-0.*cluster.uuid.*node.id.*recovered.*cluster_state.*";
|
||||
private static final String NODE_STARTED = ".*integTest-0.*cluster.uuid.*node.id.*recovered.*cluster_state.*";
|
||||
|
||||
public void testSuccessfulStartupWithCustomConfig() throws Exception {
|
||||
assertBusy(() -> {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
|
@ -24,6 +25,6 @@ dependencies {
|
|||
testCompile project(path: ':modules:ingest-common', configuration: 'runtime')
|
||||
}
|
||||
|
||||
integTestCluster {
|
||||
testClusters.integTest {
|
||||
setting 'node.ingest', 'false'
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
|
@ -24,12 +25,18 @@ integTest {
|
|||
includePackaged = true
|
||||
}
|
||||
|
||||
integTestCluster {
|
||||
numNodes = 2
|
||||
File repo = file("$buildDir/testclusters/repo")
|
||||
testClusters.integTest {
|
||||
numberOfNodes = 2
|
||||
setting 'path.repo', repo.absolutePath
|
||||
}
|
||||
|
||||
integTestRunner {
|
||||
if ('default'.equals(integTestCluster.distribution)) {
|
||||
integTest.runner {
|
||||
doFirst {
|
||||
project.delete(repo)
|
||||
repo.mkdirs()
|
||||
}
|
||||
if ('default'.equalsIgnoreCase(System.getProperty('tests.distribution', 'oss'))) {
|
||||
systemProperty 'tests.rest.blacklist', [
|
||||
'cat.templates/10_basic/No templates',
|
||||
'cat.templates/10_basic/Sort templates',
|
||||
|
|
|
@ -19,15 +19,18 @@
|
|||
|
||||
import org.elasticsearch.gradle.MavenFilteringHack
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
ext.pluginsCount = 0
|
||||
project(':plugins').getChildProjects().each { pluginName, pluginProject ->
|
||||
integTestCluster {
|
||||
plugin pluginProject.path
|
||||
int pluginsCount = 0
|
||||
|
||||
testClusters.integTest {
|
||||
project(':plugins').getChildProjects().each { pluginName, pluginProject ->
|
||||
plugin file(pluginProject.tasks.bundlePlugin.archiveFile)
|
||||
tasks.integTest.dependsOn pluginProject.tasks.bundlePlugin
|
||||
pluginsCount += 1
|
||||
}
|
||||
pluginsCount += 1
|
||||
}
|
||||
assert pluginsCount > 0
|
||||
|
||||
|
|
|
@ -17,18 +17,15 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
integTestCluster {
|
||||
setting 'node.name', null
|
||||
// Run with no discovery configuration at all, demonstrating that a node in its
|
||||
// "out-of-the-box" configuration can automatically bootstrap a cluster
|
||||
autoSetInitialMasterNodes = false
|
||||
autoSetHostsProvider = false
|
||||
testClusters.integTest {
|
||||
nameCustomization = { null }
|
||||
}
|
||||
|
||||
integTestRunner {
|
||||
integTest.runner {
|
||||
nonInputProperties.systemProperty 'tests.logfile',
|
||||
"${ -> integTest.nodes[0].homeDir}/logs/${ -> integTest.nodes[0].clusterName }_server.json"
|
||||
"${ -> testClusters.integTest.singleNode().getServerLog() }"
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.stream.Stream
|
|||
*/
|
||||
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.build'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
|
@ -88,13 +89,14 @@ task deploy(type: Copy) {
|
|||
|
||||
task writeElasticsearchProperties {
|
||||
onlyIf { !Os.isFamily(Os.FAMILY_WINDOWS) }
|
||||
dependsOn 'integTestCluster#wait', deploy
|
||||
useCluster testClusters.integTest
|
||||
dependsOn deploy
|
||||
doLast {
|
||||
final File elasticsearchProperties = file("${wildflyInstall}/standalone/configuration/elasticsearch.properties")
|
||||
elasticsearchProperties.write(
|
||||
[
|
||||
"transport.uri=${-> integTest.getNodes().get(0).transportUri()}",
|
||||
"cluster.name=${-> integTest.getNodes().get(0).clusterName}"
|
||||
"transport.uri=${-> testClusters.integTest.getAllTransportPortURI().get(0)}",
|
||||
"cluster.name=integTest"
|
||||
].join("\n"))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue