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

Add BWC tests for running against distribution bundle #587

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 109 additions & 42 deletions notifications/notifications/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,10 @@ testClusters.integTest {
}

String bwcVersion = "2.0.0.0"
Boolean bwcBundleTest = (project.findProperty('customDistributionDownloadType') != null &&
project.properties['customDistributionDownloadType'] == "bundle");
String baseName = "notificationsBwcCluster"

String bwcCurrentVersion = opensearch_version.replace("-SNAPSHOT", "")
String bwcPluginsResourcePath = "src/test/resources/plugins/bwc"
String bwcNotificationsCoreFilePath = "$bwcPluginsResourcePath/notifications-core/$bwcVersion"
String bwcNotificationsFilePath = "$bwcPluginsResourcePath/notifications/$bwcVersion"
Expand All @@ -265,45 +267,75 @@ String bwcNotificationsDownload = "https://ci.opensearch.org/ci/dbc/distribution
2.times { i ->
testClusters {
"${baseName}$i" {
testDistribution = "INTEG_TEST"
versions = ["2.0.0", opensearch_version]
numberOfNodes = 3
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcNotificationsCoreFilePath").exists()) {
project.delete(files("$project.rootDir/$bwcNotificationsCoreFilePath"))
if (bwcBundleTest) {
testDistribution = "ARCHIVE"
versions = ["2.0.0", bwcCurrentVersion]
nodes.each { node ->
node.extraConfigFile("kirk.pem", file("src/test/resources/security/kirk.pem"))
node.extraConfigFile("kirk-key.pem", file("src/test/resources/security/kirk-key.pem"))
node.extraConfigFile("esnode.pem", file("src/test/resources/security/esnode.pem"))
node.extraConfigFile("esnode-key.pem", file("src/test/resources/security/esnode-key.pem"))
node.extraConfigFile("root-ca.pem", file("src/test/resources/security/root-ca.pem"))
node.setting("plugins.security.disabled", "true")
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
node.setting("plugins.security.ssl.transport.enforce_hostname_verification", "false")
node.setting("plugins.security.ssl.http.enabled", "true")
node.setting("plugins.security.ssl.http.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.http.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.http.pemtrustedcas_filepath", "root-ca.pem")
node.setting("plugins.security.allow_unsafe_democertificates", "true")
node.setting("plugins.security.allow_default_init_securityindex", "true")
node.setting("plugins.security.authcz.admin_dn", "CN=kirk,OU=client,O=client,L=test,C=de")
node.setting("plugins.security.audit.type", "internal_elasticsearch")
node.setting("plugins.security.enable_snapshot_restore_privilege", "true")
node.setting("plugins.security.check_snapshot_restore_write_privileges", "true")
node.setting("plugins.security.restapi.roles_enabled", "[\"all_access\", \"security_rest_api_access\"]")
node.setting("plugins.security.system_indices.enabled", "true")
}
} else {
testDistribution = 'INTEG_TEST'
versions = ["2.0.0", opensearch_version]
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcNotificationsCoreFilePath").exists()) {
project.delete(files("$project.rootDir/$bwcNotificationsCoreFilePath"))
}
project.mkdir bwcNotificationsCoreFilePath
ant.get(src: bwcNotificationsCoreDownload,
dest: bwcNotificationsCoreFilePath,
httpusecaches: false)
return fileTree(bwcNotificationsCoreFilePath).getSingleFile()
}
project.mkdir bwcNotificationsCoreFilePath
ant.get(src: bwcNotificationsCoreDownload,
dest: bwcNotificationsCoreFilePath,
httpusecaches: false)
return fileTree(bwcNotificationsCoreFilePath).getSingleFile()
}
}
}
}))
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcNotificationsFilePath").exists()) {
project.delete(files("$project.rootDir/$bwcNotificationsFilePath"))
}))
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
if (new File("$project.rootDir/$bwcNotificationsFilePath").exists()) {
project.delete(files("$project.rootDir/$bwcNotificationsFilePath"))
}
project.mkdir bwcNotificationsFilePath
ant.get(src: bwcNotificationsDownload,
dest: bwcNotificationsFilePath,
httpusecaches: false)
return fileTree(bwcNotificationsFilePath).getSingleFile()
}
project.mkdir bwcNotificationsFilePath
ant.get(src: bwcNotificationsDownload,
dest: bwcNotificationsFilePath,
httpusecaches: false)
return fileTree(bwcNotificationsFilePath).getSingleFile()
}
}
}
}))
}))
}

setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
setting 'http.content_type.required', 'true'
}
Expand All @@ -326,7 +358,9 @@ task prepareBwcTests {
// Create two test clusters with 3 nodes of the old version
2.times {i ->
task "${baseName}#oldVersionClusterTask$i"(type: StandaloneRestIntegTestTask) {
dependsOn 'prepareBwcTests'
if (!bwcBundleTest){
dependsOn 'prepareBwcTests'
}
useCluster testClusters."${baseName}$i"
filter {
includeTestsMatching "org.opensearch.integtest.bwc.*IT"
Expand All @@ -345,8 +379,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()
}
} else {
doFirst {
testClusters."${baseName}0".upgradeNodeAndPluginToNextVersion(plugins)
}
}
filter {
includeTestsMatching "org.opensearch.integtest.bwc.*IT"
Expand All @@ -364,8 +404,14 @@ task "${baseName}#mixedClusterTask"(type: StandaloneRestIntegTestTask) {
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.integtest.bwc.*IT"
Expand All @@ -383,8 +429,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.integtest.bwc.*IT"
Expand All @@ -402,8 +454,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".goToNextVersion()
}
} else {
doFirst {
testClusters."${baseName}1".upgradeAllNodesAndPluginsToNextVersion(plugins)
}
}
filter {
includeTestsMatching "org.opensearch.integtest.bwc.*IT"
Expand All @@ -414,6 +472,15 @@ task "${baseName}#fullRestartClusterTask"(type: StandaloneRestIntegTestTask) {
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}1".getName()}")
}

// A bwc test suite which runs all the bwc tasks combined.
task bwcTestSuite(type: StandaloneRestIntegTestTask) {
exclude '**/*Test*'
exclude '**/*IT*'
dependsOn tasks.named("${baseName}#mixedClusterTask")
dependsOn tasks.named("${baseName}#rollingUpgradeClusterTask")
dependsOn tasks.named("${baseName}#fullRestartClusterTask")
}

run {
doFirst {
// There seems to be an issue when running multi node run or integ tasks with unicast_hosts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ hvcNAQELBQADggEBAIOKuyXsFfGv1hI/Lkpd/73QNqjqJdxQclX57GOMWNbOM5H0
XzCGMCohFfem8vnKNnKUneMQMvXd3rzUaAgvtf7Hc2LTBlf4fZzZF1EkwdSXhaMA
1lkfHiqOBxtgeDLxCHESZ2fqgVqsWX+t3qHQfivcPW6txtDyrFPRdJOGhiMGzT/t
e/9kkAtQRgpTb3skYdIOOUOV0WGQ60kJlFhAzIs=
-----END CERTIFICATE-----
-----END CERTIFICATE-----