Skip to content

Commit

Permalink
QA: Merge query-builder-bwc to restart test (#30979)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
nik9000 committed Jun 27, 2018
1 parent 2a147ea commit 1f9c9b2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 99 deletions.
2 changes: 0 additions & 2 deletions qa/full-cluster-restart/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ for (Version version : bwcVersions.indexCompatible) {
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")

}

Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
Expand All @@ -115,4 +114,3 @@ task integTest {
}

check.dependsOn(integTest)

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.elasticsearch.bwc;
package org.elasticsearch.upgrades;

import org.apache.http.util.EntityUtils;
import org.elasticsearch.Version;
Expand Down Expand Up @@ -153,7 +153,23 @@ protected boolean preserveIndicesUponCompletion() {
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 {
assumeTrue("5.x not supported", oldClusterVersion.onOrAfter(Version.V_6_0_0_alpha1));
String index = "queries";
if (runningAgainstOldCluster) {
XContentBuilder mappingsAndSettings = jsonBuilder();
Expand Down
96 changes: 0 additions & 96 deletions qa/query-builder-bwc/build.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions x-pack/qa/full-cluster-restart/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ subprojects {
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'
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
}

Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
Expand Down Expand Up @@ -234,6 +235,7 @@ subprojects {
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'
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
}

Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 1f9c9b2

Please sign in to comment.