diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index 429c40e4282ba..b25f9393af573 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -72,6 +72,7 @@ for (Version version : bwcVersions.wireCompatible) { Task oldClusterTestRunner = tasks.getByName("${baseName}#oldClusterTestRunner") oldClusterTestRunner.configure { systemProperty 'tests.rest.suite', 'old_cluster' + systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '') } Closure configureUpgradeCluster = {String name, Task lastRunner, int stopNode, Closure unicastSeed -> @@ -96,6 +97,7 @@ for (Version version : bwcVersions.wireCompatible) { oneThirdUpgradedTestRunner.configure { systemProperty 'tests.rest.suite', 'mixed_cluster' systemProperty 'tests.first_round', 'true' + systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '') finalizedBy "${baseName}#oldClusterTestCluster#node1.stop" } @@ -108,6 +110,7 @@ for (Version version : bwcVersions.wireCompatible) { twoThirdsUpgradedTestRunner.configure { systemProperty 'tests.rest.suite', 'mixed_cluster' systemProperty 'tests.first_round', 'false' + systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '') finalizedBy "${baseName}#oldClusterTestCluster#node2.stop" } @@ -119,6 +122,7 @@ for (Version version : bwcVersions.wireCompatible) { Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner") upgradedClusterTestRunner.configure { systemProperty 'tests.rest.suite', 'upgraded_cluster' + systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '') /* * Force stopping all the upgraded nodes after the test runner * so they are alive during the test. diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java index 3ed98a5d1f772..f87eb783680d3 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java @@ -19,15 +19,22 @@ package org.elasticsearch.upgrades; import org.apache.http.util.EntityUtils; -import org.elasticsearch.common.Booleans; +import org.elasticsearch.common.xcontent.DeprecationHandler; +import org.elasticsearch.common.xcontent.NamedXContentRegistry; +import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.common.xcontent.json.JsonXContent; import org.junit.Before; +import org.elasticsearch.Version; import org.elasticsearch.client.Request; -import org.elasticsearch.client.Response; import java.io.IOException; -import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; import static org.junit.Assume.assumeThat; /** @@ -36,11 +43,9 @@ */ public class XPackIT extends AbstractRollingTestCase { @Before - public void skipIfNotXPack() { + public void skipIfNotZip() { assumeThat("test is only supported if the distribution contains xpack", System.getProperty("tests.distribution"), equalTo("zip")); - assumeThat("running this on the unupgraded cluster would change its state and it wouldn't work prior to 6.3 anyway", - CLUSTER_TYPE, equalTo(ClusterType.UPGRADED)); /* * *Mostly* we want this for when we're upgrading from pre-6.3's * zip distribution which doesn't contain xpack to post 6.3's zip @@ -50,11 +55,81 @@ public void skipIfNotXPack() { } /** - * Test a basic feature (SQL) which doesn't require any trial license. - * Note that the test methods on this class can run in any order so we - * might have already installed a trial license. + * Tests that xpack is able to work itself into a sane state during the + * upgrade by testing that it is able to create all of the templates that + * it needs. This isn't a very strong assertion of sanity, but it is better + * than nothing and should catch a few sad cases. + *
+ * The trouble is that when xpack isn't able to create the templates that
+ * it needs it retries over and over and over again. This can
+ * really slow things down. This test asserts that xpack
+ * was able to create the templates so it shouldn't be
+ * spinning trying to create things and slowing down the rest of the
+ * system.
+ */
+ public void testIndexTemplatesCreated() throws Exception {
+ Version upgradeFromVersion =
+ Version.fromString(System.getProperty("tests.upgrade_from_version"));
+ boolean upgradeFromVersionHasXPack = upgradeFromVersion.onOrAfter(Version.V_6_3_0);
+ assumeFalse("this test doesn't really prove anything if the starting version has xpack and it is *much* more complex to maintain",
+ upgradeFromVersionHasXPack);
+ assumeFalse("since we're upgrading from a version without x-pack it won't have any templates",
+ CLUSTER_TYPE == ClusterType.OLD);
+
+ List