Skip to content

Commit

Permalink
Give rollling upgrade tests more information (backport of #76360) (#7…
Browse files Browse the repository at this point in the history
…6423)

* Give rollling upgrade tests more information (backport of #76360)

This passes the version that rolling upgrade tests are coming *from*
into the actual tests so they can reason about it. This is useful
because we have features that are not supported on early versions and
we want to write rolling upgrade tests for them. We can't run those
features or assert anything about them in when they don't exist. You'd
think we could use the minimum version of a node in the cluster, but
that only works in the unupgraded phases - once we've completed the
upgrade we need to have the version that we came from to know what we
did in the mixed version.

* Grumble grumble
  • Loading branch information
nik9000 committed Aug 12, 2021
1 parent a0665b3 commit 96d93d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
14 changes: 7 additions & 7 deletions qa/rolling-upgrade/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
* </ul>
*/
String baseName = "v${bwcVersion}"
String bwcVersionStr = "${bwcVersion}"

testClusters {
"${baseName}" {
versions = [bwcVersionStr, project.version]
versions = [bwcVersion.toString(), project.version]
numberOfNodes = 3

setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
Expand All @@ -44,15 +43,17 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
}

String oldVersion = bwcVersion.toString()

tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
dependsOn "processTestResources"
useCluster testClusters."${baseName}"
mustRunAfter("precommit")
doFirst {
delete("${buildDir}/cluster/shared/repo/${baseName}")
}
systemProperty 'tests.upgrade_from_version', bwcVersionStr
systemProperty 'tests.rest.suite', 'old_cluster'
systemProperty 'tests.upgrade_from_version', oldVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
}
Expand All @@ -64,7 +65,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
testClusters."${baseName}".nextNodeToNextVersion()
}
systemProperty 'tests.rest.suite', 'mixed_cluster'
systemProperty 'tests.upgrade_from_version', bwcVersionStr
systemProperty 'tests.upgrade_from_version', oldVersion
systemProperty 'tests.first_round', 'true'
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
Expand All @@ -77,7 +78,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
testClusters."${baseName}".nextNodeToNextVersion()
}
systemProperty 'tests.rest.suite', 'mixed_cluster'
systemProperty 'tests.upgrade_from_version', bwcVersionStr
systemProperty 'tests.upgrade_from_version', oldVersion
systemProperty 'tests.first_round', 'false'
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
Expand All @@ -90,8 +91,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
useCluster testClusters."${baseName}"
systemProperty 'tests.rest.suite', 'upgraded_cluster'
systemProperty 'tests.upgrade_from_version', bwcVersionStr

systemProperty 'tests.upgrade_from_version', oldVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public static ClusterType parse(String value) {
return MIXED;
case "upgraded_cluster":
return UPGRADED;
default:
throw new AssertionError("unknown cluster type: " + value);
default:
throw new AssertionError("unknown cluster type: " + value);
}
}
}

protected static final ClusterType CLUSTER_TYPE = ClusterType.parse(System.getProperty("tests.rest.suite"));
protected static final boolean FIRST_MIXED_ROUND = Boolean.parseBoolean(System.getProperty("tests.first_round", "false"));
protected static final Version UPGRADE_FROM_VERSION = Version.fromString(System.getProperty("tests.upgrade_from_version"));
protected static final boolean firstMixedRound = Boolean.parseBoolean(System.getProperty("tests.first_round", "false"));

@Override
protected final boolean preserveIndicesUponCompletion() {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/qa/rolling-upgrade/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
}
}

String oldVersion = bwcVersion.toString().replace('-SNAPSHOT', '')
String oldVersion = bwcVersion.toString()

tasks.register("${baseName}#oldClusterTest", StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}"
mustRunAfter("precommit")
Expand Down

0 comments on commit 96d93d1

Please sign in to comment.