diff --git a/notifications/notifications/build.gradle b/notifications/notifications/build.gradle index 33dc3880..4e225694 100644 --- a/notifications/notifications/build.gradle +++ b/notifications/notifications/build.gradle @@ -250,6 +250,8 @@ testClusters.integTest { } String bwcVersion = "2.0.0.0" +Boolean bwcBundleTest = (project.findProperty('customDistributionDownloadType') != null && + project.properties['customDistributionDownloadType'] == "bundle"); String baseName = "notificationsBwcCluster" String bwcPluginsResourcePath = "src/test/resources/plugins/bwc" @@ -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(){ - @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", "2.5.0"] + 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(){ + @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(){ - @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(){ + @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' } @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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 diff --git a/notifications/notifications/src/test/resources/security/sample.pem b/notifications/notifications/src/test/resources/security/sample.pem index fa785ca1..7ba92534 100644 --- a/notifications/notifications/src/test/resources/security/sample.pem +++ b/notifications/notifications/src/test/resources/security/sample.pem @@ -25,4 +25,4 @@ hvcNAQELBQADggEBAIOKuyXsFfGv1hI/Lkpd/73QNqjqJdxQclX57GOMWNbOM5H0 XzCGMCohFfem8vnKNnKUneMQMvXd3rzUaAgvtf7Hc2LTBlf4fZzZF1EkwdSXhaMA 1lkfHiqOBxtgeDLxCHESZ2fqgVqsWX+t3qHQfivcPW6txtDyrFPRdJOGhiMGzT/t e/9kkAtQRgpTb3skYdIOOUOV0WGQ60kJlFhAzIs= ------END CERTIFICATE----- \ No newline at end of file +-----END CERTIFICATE-----