Skip to content

Commit

Permalink
Fix BWC to execute rolling upgrades on main
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed May 6, 2024
1 parent 3318d31 commit d071e31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
20 changes: 7 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ buildscript {
System.setProperty('tests.security.manager', 'false')
common_utils_version = System.getProperty("common_utils.version", opensearch_build)

bwcVersionShort = "2.12.0"
bwcVersionShort = '2.14.0'
bwcVersion = bwcVersionShort + ".0"
bwcOpenSearchFFDownload = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + bwcVersionShort + '/latest/linux/x64/tar/builds/' +
'opensearch/plugins/opensearch-flow-framework-' + bwcVersion + '.zip'
baseName = "ffBwcCluster"
bwcFilePath = "src/test/resources/org/opensearch/flowframework/bwc/"
bwcFlowFrameworkPath = bwcFilePath + "flowframework/"

isSameMajorVersion = opensearch_version.split("\\.")[0] == bwcVersionShort.split("\\.")[0]
}

repositories {
Expand Down Expand Up @@ -512,8 +510,7 @@ List<Provider<RegularFile>> plugins = [

// Creates 2 test clusters with 3 nodes of the old version.
2.times {i ->
task "${baseName}#oldVersionClusterTask$i"(type: StandaloneRestIntegTestTask) {
onlyIf { isSameMajorVersion || (i == 1) }
task "${baseName}#oldVersionClusterTask$i"(type: RestIntegTestTask) {
useCluster testClusters."${baseName}$i"
filter {
includeTestsMatching "org.opensearch.flowframework.bwc.*IT"
Expand All @@ -529,8 +526,7 @@ List<Provider<RegularFile>> plugins = [
// Upgrades one node of the old cluster to new OpenSearch version with upgraded plugin version
// This results in a mixed cluster with 2 nodes on the old version and 1 upgraded node.
// This is also used as a one third upgraded cluster for a rolling upgrade.
task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
onlyIf { isSameMajorVersion }
task "${baseName}#mixedClusterTask"(type: RestIntegTestTask) {
useCluster testClusters."${baseName}0"
dependsOn "${baseName}#oldVersionClusterTask0"
doFirst {
Expand All @@ -549,8 +545,7 @@ task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
// Upgrades the second node to new OpenSearch version with upgraded plugin version after the first node is upgraded.
// This results in a mixed cluster with 1 node on the old version and 2 upgraded nodes.
// This is used for rolling upgrade.
task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTask) {
onlyIf { isSameMajorVersion }
task "${baseName}#twoThirdsUpgradedClusterTask"(type: RestIntegTestTask) {
dependsOn "${baseName}#mixedClusterTask"
useCluster testClusters."${baseName}0"
doFirst {
Expand All @@ -569,8 +564,7 @@ task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTas
// Upgrades the third node to new OpenSearch version with upgraded plugin version after the second node is upgraded.
// This results in a fully upgraded cluster.
// This is used for rolling upgrade.
task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask) {
onlyIf { isSameMajorVersion }
task "${baseName}#rollingUpgradeClusterTask"(type: RestIntegTestTask) {
dependsOn "${baseName}#twoThirdsUpgradedClusterTask"
useCluster testClusters."${baseName}0"
doFirst {
Expand All @@ -589,7 +583,7 @@ task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask)

// Upgrades all the nodes of the old cluster to new OpenSearch version with upgraded plugin version
// at the same time resulting in a fully upgraded cluster.
task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) {
task "${baseName}#fullRestartClusterTask"(type: RestIntegTestTask) {
dependsOn "${baseName}#oldVersionClusterTask1"
useCluster testClusters."${baseName}1"
doFirst {
Expand All @@ -605,7 +599,7 @@ task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) {
}

// A bwc test suite which runs all the bwc tasks combined.
task bwcTestSuite(type: StandaloneRestIntegTestTask) {
task bwcTestSuite(type: RestIntegTestTask) {
filter {
excludeTestsMatching '**.*Test*'
excludeTestsMatching '**.*IT*'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class FlowFrameworkBackwardsCompatibilityIT extends OpenSearchRestTestCas

private static final ClusterType CLUSTER_TYPE = ClusterType.parse(System.getProperty("tests.rest.bwcsuite"));
private static final String CLUSTER_NAME = System.getProperty("tests.clustername");
private static final String BWC_VERSION = System.getProperty("tests.plugin_bwc_version");

@Override
@Before
Expand Down Expand Up @@ -111,26 +112,28 @@ public void testBackwardsCompatibility() throws Exception {
List<Map<String, Object>> plugins = (List<Map<String, Object>>) response.get("plugins");
Set<Object> pluginNames = plugins.stream().map(map -> map.get("name")).collect(Collectors.toSet());
assertTrue(pluginNames.contains("opensearch-flow-framework"));

// Test change in template timestamps from 2.12 to later versions
String workflowId = createNoopTemplate();
Template t = getTemplate(workflowId);
switch (CLUSTER_TYPE) {
case OLD:
// mapping for 2.12 does not include time stamps
assertNull(t.createdTime());
assertNull(t.lastUpdatedTime());
assertNull(t.lastProvisionedTime());
if (BWC_VERSION.equals("2.12.0.0")) {
assertNull(t.createdTime());
assertNull(t.lastUpdatedTime());
}
break;
case MIXED:
// Time stamps may or may not be null depending on whether index has been accessed by new version node
assertNull(t.lastProvisionedTime());
break;
case UPGRADED:
// mapping for 2.13+ includes time stamps
assertNotNull(t.createdTime());
assertEquals(t.createdTime(), t.lastUpdatedTime());
assertNull(t.lastProvisionedTime());
break;
}
assertNull(t.lastProvisionedTime());
break;
}
}
Expand Down

0 comments on commit d071e31

Please sign in to comment.