From 0bba7c889d50a1e21d5e3d06aad947d1c8db07f4 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 7 May 2018 13:26:07 -0400 Subject: [PATCH 1/4] Test upgrading to the default distribution Adds scenarios to the rolling restart and full cluster restart upgrade test cases to test case involving the default distribution that we believe will be fairly common. Before this we'd just test upgrading from the OSS distribution to the OSS distribution. Now we'll test `OSS -> OSS` and `Default -> Default`, and, if the version we're upgrading from is *before* x-pack was part of the default distribution, then we'll also test `OSS -> Default` because we believe that'll be somewhat more common. In fact, we believe that this is the only time when it'll be common to significantly change the configuration of Elasticsearch *and* upgrade at the same time. Such upgrades come with extra risk because you are changing two things at once so we want to be super, mega, ultra sure that we test it. --- qa/build.gradle | 2 ++ qa/full-cluster-restart/build.gradle | 31 +++++++++++++++++------- qa/rolling-upgrade/build.gradle | 35 ++++++++++++++++++++-------- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/qa/build.gradle b/qa/build.gradle index 494f6e3cd94b7..24bcfd529dc9c 100644 --- a/qa/build.gradle +++ b/qa/build.gradle @@ -1,7 +1,9 @@ import org.elasticsearch.gradle.test.RestIntegTestTask +import org.elasticsearch.gradle.Version subprojects { Project subproj -> + subproj.ext.xPackOpenedVersion = Version.fromString('6.3.0') subproj.tasks.withType(RestIntegTestTask) { subproj.extensions.configure("${it.name}Cluster") { cluster -> cluster.distribution = 'oss-zip' diff --git a/qa/full-cluster-restart/build.gradle b/qa/full-cluster-restart/build.gradle index ca8371e30e7ac..196c3627a412d 100644 --- a/qa/full-cluster-restart/build.gradle +++ b/qa/full-cluster-restart/build.gradle @@ -30,9 +30,13 @@ task bwcTest { description = 'Runs backwards compatibility tests.' group = 'verification' } +task integTest { + description = 'Runs backwards comaptibility tests for recent versions.' + group = 'verification' +} -for (Version version : bwcVersions.indexCompatible) { - String baseName = "v${version}" +void setupBwcTests(Version version, String fromDistribution, String toDistribution) { + String baseName = "v${version}-${fromDistribution}-to-${toDistribution}" Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) { mustRunAfter(precommit) @@ -49,6 +53,7 @@ for (Version version : bwcVersions.indexCompatible) { numBwcNodes = 2 numNodes = 2 clusterName = 'full-cluster-restart' + distribution = fromDistribution // some tests rely on the translog not being flushed setting 'indices.memory.shard_inactive_time', '20m' @@ -71,6 +76,7 @@ for (Version version : bwcVersions.indexCompatible) { "${baseName}#oldClusterTestCluster#node0.stop", "${baseName}#oldClusterTestCluster#node1.stop" clusterName = 'full-cluster-restart' + distribution = toDistribution // some tests rely on the translog not being flushed setting 'indices.memory.shard_inactive_time', '20m' @@ -96,19 +102,26 @@ for (Version version : bwcVersions.indexCompatible) { if (project.bwc_tests_enabled) { bwcTest.dependsOn(versionBwcTest) + if (bwcVersions.snapshotsIndexCompatible.contains(version)) { + // basic integ tests includes testing bwc against the most recent version + integTest.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) { - for (final def version : bwcVersions.snapshotsIndexCompatible) { - dependsOn "v${version}#bwcTest" - } +for (Version version : bwcVersions.indexCompatible) { + setupBwcTests(version, 'oss-zip', 'oss-zip') + setupBwcTests(version, 'zip', 'zip') + if (version.before(xPackOpenedVersion)) { + /* + * If the source version is before xpack was opened then test upgrading + * from OSS to the default distribution because we expect that'll be + * fairly common. + */ + setupBwcTests(version, 'oss-zip', 'zip') } } check.dependsOn(integTest) - diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index 9f10c5dcfab73..a9f90681f6ca7 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -28,9 +28,13 @@ task bwcTest { description = 'Runs backwards compatibility tests.' group = 'verification' } +task integTest { + description = 'Runs backwards comaptibility tests for recent versions.' + group = 'verification' +} -for (Version version : bwcVersions.wireCompatible) { - String baseName = "v${version}" +void setupBwcTests(Version version, String fromDistribution, String toDistribution) { + String baseName = "v${version}-${fromDistribution}-to-${toDistribution}" Task oldClusterTest = tasks.create(name: "${baseName}#oldClusterTest", type: RestIntegTestTask) { mustRunAfter(precommit) @@ -42,6 +46,7 @@ for (Version version : bwcVersions.wireCompatible) { numBwcNodes = 2 numNodes = 2 clusterName = 'rolling-upgrade' + distribution = fromDistribution setting 'repositories.url.allowed_urls', 'http://snapshot.test*' if (version.onOrAfter('5.3.0')) { setting 'http.content_type.required', 'true' @@ -63,6 +68,7 @@ for (Version version : bwcVersions.wireCompatible) { /* Override the data directory so the new node always gets the node we * just stopped's data directory. */ dataDir = { nodeNumber -> oldClusterTest.nodes[1].dataDir } + distribution = toDistribution setting 'repositories.url.allowed_urls', 'http://snapshot.test*' } @@ -82,6 +88,7 @@ for (Version version : bwcVersions.wireCompatible) { /* Override the data directory so the new node always gets the node we * just stopped's data directory. */ dataDir = { nodeNumber -> oldClusterTest.nodes[0].dataDir} + distribution = toDistribution setting 'repositories.url.allowed_urls', 'http://snapshot.test*' } @@ -99,18 +106,26 @@ for (Version version : bwcVersions.wireCompatible) { if (project.bwc_tests_enabled) { bwcTest.dependsOn(versionBwcTest) + if (bwcVersions.snapshotsWireCompatible.contains(version)) { + // basic integ tests includes testing bwc against the most recent version + integTest.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) { - for (final def version : bwcVersions.snapshotsWireCompatible) { - dependsOn "v${version}#bwcTest" - } +for (Version version : bwcVersions.wireCompatible) { + setupBwcTests(version, 'oss-zip', 'oss-zip') + setupBwcTests(version, 'zip', 'zip') + if (version.before(xPackOpenedVersion)) { + /* + * If the source version is before xpack was opened then test upgrading + * from OSS to the default distribution because we expect that'll be + * fairly common. + */ + setupBwcTests(version, 'oss-zip', 'zip') } } +test.enabled = false // no unit tests for rolling upgrades, only the rest integration test + check.dependsOn(integTest) From 6fed44839ee46b7ba23ce3c759a0067710dabea7 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 8 May 2018 13:39:46 -0400 Subject: [PATCH 2/4] Remove dupe and add `-DbwcFlavor` --- qa/build.gradle | 20 +++++++++++++++++++- qa/full-cluster-restart/build.gradle | 17 ++++++++++------- qa/rolling-upgrade/build.gradle | 12 +++++++----- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/qa/build.gradle b/qa/build.gradle index 24bcfd529dc9c..ee4efe8f4dfec 100644 --- a/qa/build.gradle +++ b/qa/build.gradle @@ -3,7 +3,25 @@ import org.elasticsearch.gradle.test.RestIntegTestTask import org.elasticsearch.gradle.Version subprojects { Project subproj -> - subproj.ext.xPackOpenedVersion = Version.fromString('6.3.0') + subproj.ext { + String bwcFlavor = System.getProperty('bwcFlavor') + switch (bwcFlavor) { + case 'oss': + runOssUpgrades = true; + runDefaultUpgrades = false; + break; + case 'default': + runOssUpgrades = false; + runDefaultUpgrades = true; + break; + case null: + runOssUpgrades = true; + runDefaultUpgrades = true; + break; + default: + throw new InvalidUserDataException("Unknown bwc flavor ${bwcFlavor}") + } + } subproj.tasks.withType(RestIntegTestTask) { subproj.extensions.configure("${it.name}Cluster") { cluster -> cluster.distribution = 'oss-zip' diff --git a/qa/full-cluster-restart/build.gradle b/qa/full-cluster-restart/build.gradle index 196c3627a412d..c7a5e35a8f4c4 100644 --- a/qa/full-cluster-restart/build.gradle +++ b/qa/full-cluster-restart/build.gradle @@ -109,18 +109,21 @@ void setupBwcTests(Version version, String fromDistribution, String toDistributi } } -test.enabled = false // no unit tests for rolling upgrades, only the rest integration test +test.enabled = false // no unit tests for full cluster upgrades, only the rest integration test -for (Version version : bwcVersions.indexCompatible) { - setupBwcTests(version, 'oss-zip', 'oss-zip') - setupBwcTests(version, 'zip', 'zip') - if (version.before(xPackOpenedVersion)) { +String bwcFlavor = System.getProperty('bwcFlavor') +for (Version version : bwcVersions.wireCompatible) { + if (runOssUpgrades) { + setupBwcTests(version, 'oss-zip', 'oss-zip') + } + if (runDefaultUpgrades) { /* * If the source version is before xpack was opened then test upgrading * from OSS to the default distribution because we expect that'll be - * fairly common. + * fairly common. If it is after opening xpack then test upgrading xpack + * default to xpack default. zip-to-zip covers both of those cases. */ - setupBwcTests(version, 'oss-zip', 'zip') + setupBwcTests(version, 'zip', 'zip') } } diff --git a/qa/rolling-upgrade/build.gradle b/qa/rolling-upgrade/build.gradle index a9f90681f6ca7..cddce49c12876 100644 --- a/qa/rolling-upgrade/build.gradle +++ b/qa/rolling-upgrade/build.gradle @@ -114,15 +114,17 @@ void setupBwcTests(Version version, String fromDistribution, String toDistributi } for (Version version : bwcVersions.wireCompatible) { - setupBwcTests(version, 'oss-zip', 'oss-zip') - setupBwcTests(version, 'zip', 'zip') - if (version.before(xPackOpenedVersion)) { + if (runOssUpgrades) { + setupBwcTests(version, 'oss-zip', 'oss-zip') + } + if (runDefaultUpgrades) { /* * If the source version is before xpack was opened then test upgrading * from OSS to the default distribution because we expect that'll be - * fairly common. + * fairly common. If it is after opening xpack then test upgrading xpack + * default to xpack default. zip-to-zip covers both of those cases. */ - setupBwcTests(version, 'oss-zip', 'zip') + setupBwcTests(version, 'zip', 'zip') } } From d4a5a9564fad4bf262ad7435d0a551df45de7d23 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 8 May 2018 14:02:38 -0400 Subject: [PATCH 3/4] Oops --- qa/full-cluster-restart/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/full-cluster-restart/build.gradle b/qa/full-cluster-restart/build.gradle index c7a5e35a8f4c4..14aa9a057ce86 100644 --- a/qa/full-cluster-restart/build.gradle +++ b/qa/full-cluster-restart/build.gradle @@ -112,7 +112,7 @@ void setupBwcTests(Version version, String fromDistribution, String toDistributi test.enabled = false // no unit tests for full cluster upgrades, only the rest integration test String bwcFlavor = System.getProperty('bwcFlavor') -for (Version version : bwcVersions.wireCompatible) { +for (Version version : bwcVersions.indexCompatible) { if (runOssUpgrades) { setupBwcTests(version, 'oss-zip', 'oss-zip') } From ef6aa530882a29078d4cdc71c498ea2ae8e13472 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 8 May 2018 18:30:10 -0400 Subject: [PATCH 4/4] Remove extra import --- qa/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/qa/build.gradle b/qa/build.gradle index ee4efe8f4dfec..58f18e97485b2 100644 --- a/qa/build.gradle +++ b/qa/build.gradle @@ -1,6 +1,5 @@ import org.elasticsearch.gradle.test.RestIntegTestTask -import org.elasticsearch.gradle.Version subprojects { Project subproj -> subproj.ext {