Run core's full cluster restart tests with x-pack (elastic/x-pack-elasticsearch#2433)
This change pulls in the o.e.u.FullClusterRestartIT class from core and runs it as part of the x-pack full cluster restart tests. Relates elastic/x-pack-elasticsearch#1629 Original commit: elastic/x-pack-elasticsearch@87da59485f
This commit is contained in:
parent
27a8041804
commit
aaa0510821
|
@ -3,6 +3,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
|
|||
import org.elasticsearch.gradle.Version
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.Paths
|
||||
import java.util.regex.Matcher
|
||||
|
||||
// Apply the java plugin to this project so the sources can be edited in an IDE
|
||||
|
@ -59,6 +60,19 @@ Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
|||
|
||||
Project mainProject = project
|
||||
|
||||
String coreFullClusterRestartPath = project(':qa:full-cluster-restart').projectDir.toPath().resolve('src/test/java').toString()
|
||||
sourceSets {
|
||||
test {
|
||||
java {
|
||||
srcDirs += [coreFullClusterRestartPath]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
licenseHeaders {
|
||||
approvedLicenses << 'Apache'
|
||||
}
|
||||
|
||||
/**
|
||||
* Subdirectories of this project are test rolling upgrades with various
|
||||
* configuration options based on their name.
|
||||
|
@ -76,7 +90,7 @@ subprojects {
|
|||
sourceSets {
|
||||
test {
|
||||
java {
|
||||
srcDirs = ["${mainProject.projectDir}/src/test/java"]
|
||||
srcDirs = ["${mainProject.projectDir}/src/test/java", coreFullClusterRestartPath]
|
||||
}
|
||||
resources {
|
||||
srcDirs = ["${mainProject.projectDir}/src/test/resources"]
|
||||
|
@ -84,6 +98,10 @@ subprojects {
|
|||
}
|
||||
}
|
||||
|
||||
licenseHeaders {
|
||||
approvedLicenses << 'Apache'
|
||||
}
|
||||
|
||||
String outputDir = "generated-resources/${project.name}"
|
||||
|
||||
// This is a top level task which we will add dependencies to below.
|
||||
|
@ -143,6 +161,8 @@ subprojects {
|
|||
oldClusterTestRunner.configure {
|
||||
systemProperty 'tests.is_old_cluster', 'true'
|
||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||
}
|
||||
|
||||
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
||||
|
@ -156,6 +176,7 @@ subprojects {
|
|||
numNodes = 2
|
||||
clusterName = 'full-cluster-restart'
|
||||
dataDir = { nodeNum -> oldClusterTest.nodes[nodeNum].dataDir }
|
||||
cleanShared = false // We want to keep snapshots made by the old cluster!
|
||||
setupCommand 'setupTestUser', 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
||||
waitCondition = waitWithAuth
|
||||
setting 'xpack.ssl.keystore.path', 'testnode.jks'
|
||||
|
@ -174,6 +195,8 @@ subprojects {
|
|||
upgradedClusterTestRunner.configure {
|
||||
systemProperty 'tests.is_old_cluster', 'false'
|
||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||
}
|
||||
|
||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.restart;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.upgrades.FullClusterRestartIT;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
public class CoreFullClusterRestartIT extends FullClusterRestartIT {
|
||||
|
||||
@Override
|
||||
protected Settings restClientSettings() {
|
||||
String token = "Basic " + Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8));
|
||||
return Settings.builder()
|
||||
.put(ThreadContext.PREFIX + ".Authorization", token)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -75,6 +75,16 @@ public class FullClusterRestartIT extends ESRestTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveSnapshotsUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveReposUponCompletion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preserveTemplatesUponCompletion() {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue