Skip to content

Commit

Permalink
Update to 3.0.0, run backwards compatibility with OpenSearch 2.4.0 (#242
Browse files Browse the repository at this point in the history
)

* Fix: run backwards compatibility with OpenSearch 2.1.0.

Signed-off-by: dblock <dblock@dblock.org>

* Use OpenSearch 2.4.0.

Signed-off-by: dblock <dblock@dblock.org>

* Old version of job-scheduler is no longer OpenDistro.

Signed-off-by: dblock <dblock@dblock.org>

Signed-off-by: dblock <dblock@dblock.org>
  • Loading branch information
dblock authored Sep 22, 2022
1 parent 6cf9b30 commit 4d07e7d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ build
bin/
.classpath
.vscode
sample-extension-plugin/src/test/resources/
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.opensearch.gradle.test.RestIntegTestTask

buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "2.3.0-SNAPSHOT")
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
}
Expand Down
30 changes: 14 additions & 16 deletions sample-extension-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,36 +127,34 @@ testClusters.integTest {
setting 'path.repo', repo.absolutePath
}

String bwcJobSchedulerVersion = "1.13.0.0"
String baseName = "jobSchedulerBwcCluster"
String bwcOpenSearchVersion = "2.4.0"
String bwcPluginVersion = bwcOpenSearchVersion + ".0"
String bwcFilePath = "src/test/resources/bwc/job-scheduler/"

String bwc_js_download_url = "https://github.com/opendistro-for-elasticsearch/job-scheduler/releases/download/v" +
bwcJobSchedulerVersion + "/job-scheduler-artifacts.zip"
String bwcJobSchedulerPlugin = "job-scheduler-artifacts.zip"
String bwcFileName = "opensearch-job-scheduler-" + bwcPluginVersion + ".zip"
String bwcDownloadUrl = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + bwcOpenSearchVersion + "/latest/linux/x64/tar/builds/opensearch/plugins/" + bwcFileName

2.times {i ->
testClusters {
"${baseName}$i" {
testDistribution = "ARCHIVE"
versions = ["7.10.2",opensearch_version]
versions = [bwcOpenSearchVersion, opensearch_version]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
File dir = new File(rootDir.path + "/sample-extension-plugin/" + bwcFilePath + bwcJobSchedulerVersion)

File dir = new File(rootDir.path + "/sample-extension-plugin/" + bwcFilePath + bwcPluginVersion)
if (!dir.exists()) {
dir.mkdirs()
}
File f = new File(dir, bwcJobSchedulerPlugin)
File f = new File(dir, bwcFileName)
if (!f.exists()) {
new URL(bwc_js_download_url).withInputStream{ ins -> f.withOutputStream{ it << ins }}
new URL(bwcDownloadUrl).withInputStream{ ins -> f.withOutputStream{ it << ins }}
}
return fileTree(bwcFilePath + bwcJobSchedulerVersion).getSingleFile()
return f
}
}
}
Expand Down Expand Up @@ -191,7 +189,7 @@ task prepareBwcTests {
}
systemProperty 'tests.rest.bwcsuite', 'old_cluster'
systemProperty 'tests.rest.bwcsuite_round', 'old'
systemProperty 'tests.plugin_bwc_version', bwcJobSchedulerVersion
systemProperty 'tests.plugin_bwc_version', bwcPluginVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}$i".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}$i".getName()}")
}
Expand All @@ -211,7 +209,7 @@ task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
}
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster'
systemProperty 'tests.rest.bwcsuite_round', 'first'
systemProperty 'tests.plugin_bwc_version', bwcJobSchedulerVersion
systemProperty 'tests.plugin_bwc_version', bwcPluginVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
}
Expand All @@ -230,7 +228,7 @@ task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTas
}
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster'
systemProperty 'tests.rest.bwcsuite_round', 'second'
systemProperty 'tests.plugin_bwc_version', bwcJobSchedulerVersion
systemProperty 'tests.plugin_bwc_version', bwcPluginVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
}
Expand All @@ -250,7 +248,7 @@ task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask)
mustRunAfter "${baseName}#mixedClusterTask"
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster'
systemProperty 'tests.rest.bwcsuite_round', 'third'
systemProperty 'tests.plugin_bwc_version', bwcJobSchedulerVersion
systemProperty 'tests.plugin_bwc_version', bwcPluginVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
}
Expand All @@ -267,7 +265,7 @@ task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) {
includeTestsMatching "org.opensearch.jobscheduler.sampleextension.bwc.*IT"
}
systemProperty 'tests.rest.bwcsuite', 'upgraded_cluster'
systemProperty 'tests.plugin_bwc_version', bwcJobSchedulerVersion
systemProperty 'tests.plugin_bwc_version', bwcPluginVersion
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}1".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}1".getName()}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,12 @@ public void testBackwardsCompatibility() throws Exception {

switch (CLUSTER_TYPE) {
case OLD:
case MIXED:
/*
* as only the old version of job-scheduler plugin is loaded, we only assert that it is loaded.
*/
Assert.assertTrue(pluginNames.contains("opendistro-job-scheduler"));
Assert.assertTrue(pluginNames.contains("opensearch-job-scheduler"));
break;
case MIXED:
/*
* for a 3-node mixedClusterTask, 1st node is upgraded, & 2 remaining nodes still have old versions.
* for a 3-node twoThirdsUpgradedClusterTask, 2 nodes are upgraded, & 1 remaining node still have old versions.
* for a 3-node rollingUpgradeClusterTask, all 3 nodes are upgraded.
* so for first 2 scenarios, we assert, 3rd node still has older version of job-scheduler plugin & 1st/2nd node is upgraded to use latest plugins.
* we cannot trigger a call for scheduling watcher job, as the older nodes do not have sample-extension plugin.
*/
Map<String, Object> responseForOldNode = getAsMap(getPluginUriForMixedCluster("third"));
Map<String, Map<String, Object>> responseMapForOldNode = (Map<String, Map<String, Object>>) responseForOldNode.get("nodes");

for (Map<String, Object> respValuesForOldNode: responseMapForOldNode.values()) {
List<Map<String, Object>> pluginsForOldNode = (List<Map<String, Object>>) respValuesForOldNode.get("plugins");
List<String> pluginNamesForOldNode = pluginsForOldNode.stream().map(plugin -> plugin.get("name").toString()).collect(Collectors.toList());
Assert.assertTrue("third".equals(System.getProperty("tests.rest.bwcsuite_round")) ||
pluginNamesForOldNode.contains("opendistro-job-scheduler"));
}
case UPGRADED:
/*
* As cluster is fully upgraded either by full restart or rolling upgrade, we assert, that all nodes are upgraded to use latest plugins.
Expand Down

0 comments on commit 4d07e7d

Please sign in to comment.