diff --git a/build.gradle b/build.gradle index aba7c3d1b..af0da384d 100644 --- a/build.gradle +++ b/build.gradle @@ -627,8 +627,13 @@ task integTestRemote(type: RestIntegTestTask) { exclude 'org/opensearch/indexmanagement/indexstatemanagement/action/SnapshotActionIT.class' } -String bwcVersion = "1.13.2.0" +String bwcMinVersion = "1.13.2.0" String bwcJobSchedulerVersion = "1.13.0.0" +String bwcBundleVersion = "1.3.2.0" +Boolean bwcBundleTest = (project.findProperty('customDistributionDownloadType') != null && + project.properties['customDistributionDownloadType'] == "bundle"); +String bwcVersion = bwcBundleTest ? bwcBundleVersion : bwcMinVersion +String bwcCurrentVersion = opensearch_version.replace("-SNAPSHOT", "") String baseName = "indexmanagementBwcCluster" String bwcFilePath = "src/test/resources/bwc/" String bwc_js_resource_location = bwcFilePath + "job-scheduler/" + bwcJobSchedulerVersion @@ -641,38 +646,67 @@ getPluginResource(bwc_js_resource_location, bwc_js_download_url) // Downloads the bwc index management version String bwc_im_download_url = "https://github.com/opendistro-for-elasticsearch/index-management/releases/download/v" + - bwcVersion + "/index-management-artifacts.zip" + bwcMinVersion + "/index-management-artifacts.zip" getPluginResource(bwc_im_resource_location, bwc_im_download_url) 2.times {i -> testClusters { "${baseName}$i" { testDistribution = "ARCHIVE" - versions = ["7.10.2", opensearch_version] numberOfNodes = 3 - plugin(provider(new Callable(){ - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return fileTree(bwc_js_resource_location).getSingleFile() + if (bwcBundleTest) { + versions = ["1.3.2", 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 { + versions = ["7.10.2", opensearch_version] + plugin(provider(new Callable(){ + @Override + RegularFile call() throws Exception { + return new RegularFile() { + @Override + File getAsFile() { + return fileTree(bwc_js_resource_location).getSingleFile() + } } } - } - })) + })) - plugin(provider(new Callable(){ - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return fileTree(bwc_im_resource_location).getSingleFile() + plugin(provider(new Callable(){ + @Override + RegularFile call() throws Exception { + return new RegularFile() { + @Override + File getAsFile() { + return fileTree(bwc_im_resource_location).getSingleFile() + } } } - } - })) + })) + } + setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}" setting 'http.content_type.required', 'true' } @@ -708,7 +742,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.indexmanagement.bwc.*IT" @@ -727,8 +763,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.indexmanagement.bwc.*IT" @@ -746,8 +788,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.indexmanagement.bwc.*IT" @@ -765,8 +813,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.indexmanagement.bwc.*IT" @@ -784,8 +838,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.indexmanagement.bwc.*IT" diff --git a/src/test/kotlin/org/opensearch/indexmanagement/bwc/IndexManagementBackwardsCompatibilityIT.kt b/src/test/kotlin/org/opensearch/indexmanagement/bwc/IndexManagementBackwardsCompatibilityIT.kt index 84344d181..1cc5ec876 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/bwc/IndexManagementBackwardsCompatibilityIT.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/bwc/IndexManagementBackwardsCompatibilityIT.kt @@ -56,7 +56,7 @@ class IndexManagementBackwardsCompatibilityIT : IndexManagementRestTestCase() { val pluginNames = plugins.map { plugin -> plugin ["name"] }.toSet() when (CLUSTER_TYPE) { ClusterType.OLD -> { - assertTrue(pluginNames.contains("opendistro-index-management")) + assertTrue(pluginNames.contains("opendistro-index-management") || pluginNames.contains("opensearch-index-management")) createBasicPolicy() verifyPolicyExists(LEGACY_POLICY_BASE_URI)