QA: Merge query-builder-bwc to restart test (#30979)
Merges the `query-builder-bwc` qa project into the `full-cluster-restart` qa project, saving a cluster starts on every build and *many* cluster starts on `./gradlew bwcTests`.
This commit is contained in:
parent
50e60a510d
commit
d0c276c456
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.bwc;
|
package org.elasticsearch.upgrades;
|
||||||
|
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
|
@ -153,6 +153,21 @@ public class QueryBuilderBWCIT extends ESRestTestCase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean preserveSnapshotsUponCompletion() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean preserveReposUponCompletion() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean preserveTemplatesUponCompletion() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void testQueryBuilderBWC() throws Exception {
|
public void testQueryBuilderBWC() throws Exception {
|
||||||
String index = "queries";
|
String index = "queries";
|
||||||
if (runningAgainstOldCluster) {
|
if (runningAgainstOldCluster) {
|
|
@ -1,89 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
||||||
import org.elasticsearch.gradle.Version
|
|
||||||
import org.elasticsearch.gradle.VersionProperties
|
|
||||||
|
|
||||||
apply plugin: 'elasticsearch.standalone-test'
|
|
||||||
|
|
||||||
// This is a top level task which we will add dependencies to below.
|
|
||||||
// It is a single task that can be used to backcompat tests against all versions.
|
|
||||||
task bwcTest {
|
|
||||||
description = 'Runs backwards compatibility tests.'
|
|
||||||
group = 'verification'
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Version version : bwcVersions.indexCompatible) {
|
|
||||||
String baseName = "v${version}"
|
|
||||||
|
|
||||||
Task oldQueryBuilderTest = tasks.create(name: "${baseName}#oldQueryBuilderTest", type: RestIntegTestTask) {
|
|
||||||
mustRunAfter(precommit)
|
|
||||||
}
|
|
||||||
tasks.getByName("${baseName}#oldQueryBuilderTestRunner").configure {
|
|
||||||
systemProperty 'tests.is_old_cluster', 'true'
|
|
||||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(extensions.findByName("${baseName}#oldQueryBuilderTestCluster")) {
|
|
||||||
bwcVersion = version
|
|
||||||
numBwcNodes = 1
|
|
||||||
numNodes = 1
|
|
||||||
clusterName = 'query_builder_bwc'
|
|
||||||
setting 'http.content_type.required', 'true'
|
|
||||||
}
|
|
||||||
|
|
||||||
Task upgradedQueryBuilderTest = tasks.create(name: "${baseName}#upgradedQueryBuilderTest", type: RestIntegTestTask) {
|
|
||||||
dependsOn(oldQueryBuilderTest, "${baseName}#oldQueryBuilderTestCluster#stop")
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(extensions.findByName("${baseName}#upgradedQueryBuilderTestCluster")) {
|
|
||||||
dependsOn oldQueryBuilderTest,
|
|
||||||
"${baseName}#oldQueryBuilderTestCluster#stop"
|
|
||||||
clusterName = 'query_builder_bwc'
|
|
||||||
numNodes = 1
|
|
||||||
dataDir = { nodeNum -> oldQueryBuilderTest.nodes[nodeNum].dataDir }
|
|
||||||
cleanShared = false // We want to keep snapshots made by the old cluster!
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.getByName("${baseName}#upgradedQueryBuilderTestRunner").configure {
|
|
||||||
systemProperty 'tests.is_old_cluster', 'false'
|
|
||||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
|
||||||
dependsOn = [upgradedQueryBuilderTest]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (project.bwc_tests_enabled) {
|
|
||||||
bwcTest.dependsOn(versionBwcTest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test.enabled = false // no unit tests for rolling upgrades, only the rest integration test
|
|
||||||
|
|
||||||
// basic integ tests includes testing bwc against the most recent version
|
|
||||||
task integTest {
|
|
||||||
if (project.bwc_tests_enabled) {
|
|
||||||
final def version = bwcVersions.snapshotsIndexCompatible.first()
|
|
||||||
dependsOn "v${version}#bwcTest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
check.dependsOn(integTest)
|
|
|
@ -184,6 +184,7 @@ subprojects {
|
||||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||||
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
||||||
}
|
}
|
||||||
|
|
||||||
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
|
||||||
|
@ -222,6 +223,7 @@ subprojects {
|
||||||
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
|
||||||
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
||||||
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
||||||
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
||||||
}
|
}
|
||||||
|
|
||||||
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* 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 java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class QueryBuilderBWCIT extends org.elasticsearch.upgrades.QueryBuilderBWCIT {
|
||||||
|
|
||||||
|
@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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue