-
Notifications
You must be signed in to change notification settings - Fork 73
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
Adding mixed cluster, rolling upgrade, restart upgrade bwc tests #158
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
|
||
import java.util.concurrent.Callable | ||
import org.opensearch.gradle.test.RestIntegTestTask | ||
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask | ||
|
||
buildscript { | ||
ext { | ||
|
@@ -184,6 +185,12 @@ integTest { | |
} | ||
} | ||
|
||
if (System.getProperty("tests.rest.bwcsuite") == null) { | ||
filter { | ||
excludeTestsMatching "org.opensearch.ad.bwc.*IT" | ||
} | ||
} | ||
|
||
// The 'doFirst' delays till execution time. | ||
doFirst { | ||
// Tell the test JVM if the cluster JVM is running under a debugger so that tests can | ||
|
@@ -259,6 +266,180 @@ testClusters.integTest { | |
} | ||
} | ||
|
||
String bwcVersion = "1.13.0.0"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets test with last known latest release, I believe it was 1.13.2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it thank you. |
||
String baseName = "adBwcCluster" | ||
String bwcFilePath = "src/test/resources/org/opensearch/ad/bwc/" | ||
|
||
testClusters { | ||
"${baseName}" { | ||
testDistribution = "ARCHIVE" | ||
versions = ["7.10.2","1.0.0"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have a way to define these versions as this is not scalable for each release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is temporary, we will definitely need a way to define versions for each release. I will open an issue for this. |
||
numberOfNodes = 3 | ||
plugin(provider(new Callable<RegularFile>(){ | ||
@Override | ||
RegularFile call() throws Exception { | ||
return new RegularFile() { | ||
@Override | ||
File getAsFile() { | ||
return fileTree(bwcFilePath + "job-scheduler/" + bwcVersion).getSingleFile() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comment here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracking in issue: opensearch-project/opensearch-build#184 |
||
} | ||
} | ||
} | ||
})) | ||
plugin(provider(new Callable<RegularFile>(){ | ||
@Override | ||
RegularFile call() throws Exception { | ||
return new RegularFile() { | ||
@Override | ||
File getAsFile() { | ||
return fileTree(bwcFilePath + "anomaly-detection/" + bwcVersion).getSingleFile() | ||
} | ||
} | ||
} | ||
})) | ||
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}" | ||
setting 'http.content_type.required', 'true' | ||
} | ||
} | ||
|
||
List<Provider<RegularFile>> plugins = [ | ||
provider(new Callable<RegularFile>(){ | ||
@Override | ||
RegularFile call() throws Exception { | ||
return new RegularFile() { | ||
@Override | ||
File getAsFile() { | ||
return fileTree(bwcFilePath + "job-scheduler/" + project.version).getSingleFile() | ||
} | ||
} | ||
} | ||
}), | ||
provider(new Callable<RegularFile>(){ | ||
@Override | ||
RegularFile call() throws Exception { | ||
return new RegularFile() { | ||
@Override | ||
File getAsFile() { | ||
return fileTree(bwcFilePath + "anomaly-detection/" + project.version).getSingleFile() | ||
} | ||
} | ||
} | ||
}) | ||
] | ||
|
||
// Creates a test cluster with 3 nodes of the old version. | ||
task "${baseName}#oldVersionClusterTask"(type: StandaloneRestIntegTestTask) { | ||
useCluster testClusters."${baseName}" | ||
if (System.getProperty("mixedCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInAMixedCluster") | ||
} | ||
} | ||
if (System.getProperty("rollingUpgradeCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInARollingUpgradedCluster") | ||
} | ||
} | ||
if (System.getProperty("fullRestartCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInAnUpgradedCluster") | ||
} | ||
} | ||
systemProperty 'tests.rest.bwcsuite', 'old_cluster' | ||
systemProperty 'tests.rest.bwcsuite_round', 'old' | ||
systemProperty 'tests.plugin_bwc_version', bwcVersion | ||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}") | ||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}") | ||
} | ||
|
||
// 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) { | ||
dependsOn "${baseName}#oldVersionClusterTask" | ||
useCluster testClusters."${baseName}" | ||
doFirst { | ||
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(plugins) | ||
} | ||
if (System.getProperty("mixedCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInAMixedCluster") | ||
} | ||
} | ||
if (System.getProperty("rollingUpgradeCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInARollingUpgradedCluster") | ||
} | ||
} | ||
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster' | ||
systemProperty 'tests.rest.bwcsuite_round', 'first' | ||
systemProperty 'tests.plugin_bwc_version', bwcVersion | ||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}") | ||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".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}" | ||
doFirst { | ||
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(plugins) | ||
} | ||
if (System.getProperty("rollingUpgradeCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInARollingUpgradedCluster") | ||
} | ||
} | ||
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster' | ||
systemProperty 'tests.rest.bwcsuite_round', 'second' | ||
systemProperty 'tests.plugin_bwc_version', bwcVersion | ||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}") | ||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}") | ||
} | ||
|
||
// 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) { | ||
dependsOn "${baseName}#twoThirdsUpgradedClusterTask" | ||
useCluster testClusters."${baseName}" | ||
doFirst { | ||
testClusters."${baseName}".upgradeNodeAndPluginToNextVersion(plugins) | ||
} | ||
if (System.getProperty("rollingUpgradeCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInARollingUpgradedCluster") | ||
} | ||
} | ||
systemProperty 'tests.rest.bwcsuite', 'mixed_cluster' | ||
systemProperty 'tests.rest.bwcsuite_round', 'third' | ||
systemProperty 'tests.plugin_bwc_version', bwcVersion | ||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}") | ||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}") | ||
} | ||
|
||
// 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. | ||
tasks.register("${baseName}#fullRestartClusterTask", StandaloneRestIntegTestTask) { | ||
dependsOn "${baseName}#oldVersionClusterTask" | ||
useCluster testClusters."${baseName}" | ||
doFirst { | ||
testClusters."${baseName}".upgradeAllNodesAndPluginsToNextVersion(plugins) | ||
} | ||
if (System.getProperty("fullRestartCluster") != null) { | ||
filter { | ||
includeTest("org.opensearch.ad.bwc.ADBackwardsCompatibilityIT", "testPluginUpgradeInAnUpgradedCluster") | ||
} | ||
} | ||
systemProperty 'tests.rest.bwcsuite', 'upgraded_cluster' | ||
systemProperty 'tests.plugin_bwc_version', bwcVersion | ||
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}") | ||
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}") | ||
} | ||
|
||
|
||
run { | ||
doFirst { | ||
// There seems to be an issue when running multi node run or integ tasks with unicast_hosts | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the tests are explicitly excluded in integTests, if BWC tests do not have any dependencies we should just let it run as part of the integtests which will be part of
gradle build
and will run in CI for every PR commit.Ref: AD CI https://github.com/opensearch-project/anomaly-detection/blob/main/.github/workflows/CI.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are currently excluded from the
integTest
as they need some additional setup to be run in CI, if I include them withintegTest
right now without the changes, the workflow would fail. I figured that we could exclude currently and then hook them to CI (as part ofintegTest
) as part of the next task. LMK what you think.