Skip to content

Commit

Permalink
Bux Fix in rolling upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Jain <[email protected]>
  • Loading branch information
vibrantvarun committed Dec 20, 2023
1 parent a92e37c commit 723fc13
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions qa/rolling-upgrade/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
import org.apache.tools.ant.taskdefs.condition.Os

import java.util.concurrent.Callable

apply from : "$rootDir/qa/build.gradle"

String default_bwc_version = System.getProperty("bwc.version")
Expand All @@ -14,12 +16,36 @@ boolean isSnapshot = neural_search_bwc_version.contains("-SNAPSHOT")
String knn_bwc_version_no_qualifier = isSnapshot ? neural_search_bwc_version - "-SNAPSHOT" : neural_search_bwc_version
String baseName = "neuralSearchBwcCluster-rolling"

List<Provider<RegularFile>> plugins = [provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return configurations.zipArchive.asFileTree.matching{include "**/opensearch-ml-plugin-${opensearch_build}.zip"}.getSingleFile()
}
}
}
}), provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return configurations.zipArchive.asFileTree.matching{include "**/opensearch-knn-${opensearch_build}.zip"}.getSingleFile()
}
}
}
}), rootProject.tasks.bundlePlugin.archiveFile]

// Creates a test cluster of previous version and loads k-NN plugin of bwcVersion
testClusters {
"${baseName}" {
testDistribution = "ARCHIVE"
versions = [neural_search_bwc_version, opensearch_version]
numberOfNodes = 3
plugin(project.tasks.zipBwcMlCommonsPlugin.archiveFile)
plugin(project.tasks.zipBwcKnnPlugin.archiveFile)
plugin(project.tasks.zipBwcPlugin.archiveFile)
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'http.content_type.required', 'true'
Expand All @@ -37,6 +63,8 @@ testClusters {

// Task to run BWC tests against the old cluster
task testAgainstOldCluster(type: StandaloneRestIntegTestTask) {
dependsOn "zipBwcMlCommonsPlugin"
dependsOn "zipBwcKnnPlugin"
dependsOn "zipBwcPlugin"
useCluster testClusters."${baseName}"
systemProperty 'tests.rest.bwcsuite_cluster', 'old_cluster'
Expand All @@ -47,18 +75,16 @@ task testAgainstOldCluster(type: StandaloneRestIntegTestTask) {
systemProperty 'tests.security.manager', 'false'
}


// Part of rolling upgrade. 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.
task testAgainstOneThirdUpgradedCluster(type: StandaloneRestIntegTestTask) {
dependsOn "testAgainstOldCluster"
useCluster testClusters."${baseName}"
//dependsOn rootProject.tasks.buildJniLib
dependsOn rootProject.tasks.assemble
dependsOn "testAgainstOldCluster"
doFirst {
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-0").environment("LD_LIBRARY_PATH", "$rootDir/jni/release")
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-0").systemProperty("java.library.path", "$rootDir/jni/release")
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion([rootProject.tasks.bundlePlugin.archiveFile])
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-0").upgradeNodeAndPluginToNextVersion(plugins)
}
systemProperty 'tests.rest.bwcsuite_cluster', 'mixed_cluster'
systemProperty 'tests.rest.first_round', 'true'
Expand All @@ -77,7 +103,7 @@ task testAgainstTwoThirdsUpgradedCluster(type: StandaloneRestIntegTestTask) {
doFirst {
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-1").environment("LD_LIBRARY_PATH", "$rootDir/jni/release")
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-1").systemProperty("java.library.path", "$rootDir/jni/release")
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion([rootProject.tasks.bundlePlugin.archiveFile])
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-1").upgradeNodeAndPluginToNextVersion(plugins)
}
systemProperty 'tests.rest.bwcsuite_cluster', 'mixed_cluster'
systemProperty 'tests.rest.first_round', 'false'
Expand All @@ -96,7 +122,7 @@ task testRollingUpgrade(type: StandaloneRestIntegTestTask) {
doFirst {
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-2").environment("LD_LIBRARY_PATH", "$rootDir/jni/release")
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-2").systemProperty("java.library.path", "$rootDir/jni/release")
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion([rootProject.tasks.bundlePlugin.archiveFile])
testClusters."${baseName}".getNodes().getAt("${baseName}" + "-2").upgradeNodeAndPluginToNextVersion(plugins)
}
mustRunAfter "testAgainstOneThirdUpgradedCluster"
systemProperty 'tests.rest.bwcsuite_cluster', 'upgraded_cluster'
Expand Down

0 comments on commit 723fc13

Please sign in to comment.