From d071e3162e181703d50db9c5742610a11c18fa0e Mon Sep 17 00:00:00 2001 From: Daniel Widdis Date: Sat, 4 May 2024 21:04:59 -0700 Subject: [PATCH] Fix BWC to execute rolling upgrades on main Signed-off-by: Daniel Widdis --- build.gradle | 20 +++++++------------ ...FlowFrameworkBackwardsCompatibilityIT.java | 13 +++++++----- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 0d773b84b..26fa8447c 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -512,8 +510,7 @@ List> 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" @@ -529,8 +526,7 @@ List> 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 { @@ -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 { @@ -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 { @@ -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 { @@ -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*' diff --git a/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java b/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java index 108252465..fcd8c554f 100644 --- a/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java +++ b/src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java @@ -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 @@ -111,26 +112,28 @@ public void testBackwardsCompatibility() throws Exception { List> plugins = (List>) response.get("plugins"); Set 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; } }