Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboard to bundle bwc tests with feature flag -PcustomDistributionDow… #575

Merged
merged 8 commits into from
May 28, 2024
2 changes: 1 addition & 1 deletion .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
echo "Running backwards compatibility tests ..."
chown -R 1000:1000 `pwd`
su `id -un 1000` -c "./gradlew bwcTestSuite -Dtests.security.manager=false"
su `id -un 1000` -c "./gradlew bwcTestSuite -Dtests.security.manager=false -PcustomDistributionDownloadType=bundle"
finnegancarroll marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload failed logs
uses: actions/upload-artifact@v2
if: failure()
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ The project in this package uses the [Gradle](https://docs.gradle.org/current/us
5. `./gradlew integTest -PnumNodes=3` launches a multi-node cluster with the asynchronous search plugin installed and runs all integ tests.
6. `./gradlew integTest -Dtests.class=*AsynchronousSearchRestIT` runs a single integ class
7. `./gradlew integTest -Dtests.class=*AsynchronousSearchRestIT -Dtests.method="testSubmitWithRetainedResponse"` runs a single integ test method (remember to quote the test method name if it contains spaces)
8. `./gradlew asynSearchCluster#mixedClusterTask -Dtests.security.manager=false` launches a cluster of three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing rolling upgrade of one node with the current version of OpenSearch with async search plugin.
9. `./gradlew asynSearchCluster#rollingUpgradeClusterTask -Dtests.security.manager=false` launches a cluster with three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing rolling upgrade of all nodes with the current version of OpenSearch with async search plugin.
10. `./gradlew asynSearchCluster#fullRestartClusterTask -Dtests.security.manager=false` launches a cluster with three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing a full restart on the cluster upgrading all the nodes with the current version of OpenSearch with async search plugin.
11. `./gradlew bwcTestSuite -Dtests.security.manager=false` runs all the above bwc tests combined.
8. `./gradlew asynSearchCluster#mixedClusterTask -Dtests.security.manager=false -PcustomDistributionDownloadType=bundle` launches a cluster of three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing rolling upgrade of one node with the current version of OpenSearch with async search plugin.
finnegancarroll marked this conversation as resolved.
Show resolved Hide resolved
9. `./gradlew asynSearchCluster#rollingUpgradeClusterTask -Dtests.security.manager=false -PcustomDistributionDownloadType=bundle` launches a cluster with three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing rolling upgrade of all nodes with the current version of OpenSearch with async search plugin.
10. `./gradlew asynSearchCluster#fullRestartClusterTask -Dtests.security.manager=false -PcustomDistributionDownloadType=bundle` launches a cluster with three nodes of bwc version of OpenSearch with async search plugin and tests backwards compatibility by performing a full restart on the cluster upgrading all the nodes with the current version of OpenSearch with async search plugin.
11. `./gradlew bwcTestSuite -Dtests.security.manager=false -PcustomDistributionDownloadType=bundle` runs all the above bwc tests combined.
12. `./gradlew integTestRemote -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin` launches integration tests against a local cluster and run tests with security`./gradlew integTestRemote -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=<admin-password>` launches integration tests against a local cluster and run tests with security

When launching a cluster using one of the above commands, logs are placed in `build/testclusters/integTest-0/logs`. Though the logs are teed to the console, in practices it's best to check the actual log file.
Expand Down
91 changes: 68 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -258,33 +258,53 @@ ext.getPluginResource = { download_to_folder, download_from_src ->
return fileTree(download_to_folder).getSingleFile()
}

Boolean bwcBundleTest = (project.findProperty('customDistributionDownloadType') != null &&
project.properties['customDistributionDownloadType'] == "bundle");

/*
When testing between major versions note that ONLY the latest minor release of the previous version is api compatible.
*/

String bwcVersion = "2.15.0.0"
String bwcVersionShort = bwcVersion.replaceAll(/\.0+$/, "")

String nxtVersion = opensearch_version
String nxtVersionShort = nxtVersion.replaceAll(/\.0+$/, "").replaceAll("-SNAPSHOT", "")
finnegancarroll marked this conversation as resolved.
Show resolved Hide resolved

String baseName = "asynSearchCluster"
String bwcVersionShort = "2.15.0"
String bwcVersion = bwcVersionShort + ".0"
String bwcFilePath = "src/test/resources/org/opensearch/search/asynchronous/bwc/"
String bwcRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/"+ bwcVersionShort + "/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-asynchronous-search-"+ bwcVersion +".zip"
String bwcRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + bwcVersionShort + "/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-asynchronous-search-" + bwcVersion + ".zip"

// Creates two test clusters of previous version and loads opensearch plugin of bwcVersion
2.times { i ->
testClusters {
"${baseName}$i" {
testDistribution = "ARCHIVE"
versions = [bwcVersionShort,opensearch_version]
versions = [bwcVersionShort, nxtVersionShort]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>() {
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File(bwcFilePath + bwcVersion).exists()) {
project.delete(files(bwcFilePath + bwcVersion))

if (!bwcBundleTest) {
plugin(provider(new Callable<RegularFile>() {
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File(bwcFilePath + bwcVersion).exists()) {
project.delete(files(bwcFilePath + bwcVersion))
}
getPluginResource(bwcFilePath + bwcVersion, bwcRemoteFile)
return fileTree(bwcFilePath + bwcVersion).getSingleFile()
}
getPluginResource(bwcFilePath + bwcVersion, bwcRemoteFile)
return fileTree(bwcFilePath + bwcVersion).getSingleFile()
}
}
}))
} else {
nodes.each { node ->
node.setting("plugins.security.disabled", "true")
}
}))
}

setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'http.content_type.required', 'true'
systemProperty "java.library.path", "$rootDir/src/test/resources/org/opensearch/search/asynchronous/lib:$rootDir/jni/release"
Expand Down Expand Up @@ -339,8 +359,14 @@ task prepareBwcTests {
task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
useCluster testClusters."${baseName}0"
dependsOn "${baseName}#oldVersionClusterTask0"
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
if (bwcBundleTest){
doFirst {
testClusters."${baseName}0".nextNodeToNextVersion()
finnegancarroll marked this conversation as resolved.
Show resolved Hide resolved
}
} else {
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
}
}
filter {
includeTestsMatching "org.opensearch.search.asynchronous.bwc.*IT"
Expand All @@ -350,14 +376,21 @@ task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}0".allHttpSocketURI.join(",")}")
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}0".getName()}")
}

// 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) {
dependsOn "${baseName}#mixedClusterTask"
useCluster testClusters."${baseName}0"
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
if (bwcBundleTest){
doFirst {
testClusters."${baseName}0".nextNodeToNextVersion()
}
} else {
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
}
}
filter {
includeTestsMatching "org.opensearch.search.asynchronous.bwc.*IT"
Expand All @@ -374,8 +407,14 @@ task "${baseName}#twoThirdsUpgradedClusterTask"(type: StandaloneRestIntegTestTas
task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask) {
dependsOn "${baseName}#twoThirdsUpgradedClusterTask"
useCluster testClusters."${baseName}0"
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
if (bwcBundleTest){
doFirst {
testClusters."${baseName}0".nextNodeToNextVersion()
}
} else {
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
}
}
filter {
includeTestsMatching "org.opensearch.search.asynchronous.bwc.*IT"
Expand All @@ -392,8 +431,14 @@ task "${baseName}#rollingUpgradeClusterTask"(type: StandaloneRestIntegTestTask)
task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) {
dependsOn "${baseName}#oldVersionClusterTask1"
useCluster testClusters."${baseName}1"
doFirst {
testClusters."${baseName}1".upgradeAllNodesAndPluginsToNextVersion(plugins)
if (bwcBundleTest){
doFirst {
testClusters."${baseName}1".nextNodeToNextVersion()
}
} else {
doFirst {
testClusters."${baseName}1".upgradeNodeAndPluginToNextVersion(plugins)
}
}
filter {
includeTestsMatching "org.opensearch.search.asynchronous.bwc.*IT"
Expand Down
Binary file not shown.
Binary file not shown.
Loading