diff --git a/alerting/build.gradle b/alerting/build.gradle index ace860b40..3d3ede5c2 100644 --- a/alerting/build.gradle +++ b/alerting/build.gradle @@ -97,6 +97,13 @@ integTest.dependsOn(bundle) integTest.getClusters().forEach{c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))} def _numNodes = findProperty('numNodes') as Integer ?: 1 + +String notificationsFilePath = "src/test/resources/notifications" +String notificationsCoreFilePath = "src/test/resources/notifications-core" +String notificationsPlugin = "opensearch-notifications-" + plugin_no_snapshot + ".zip" +String notificationsCorePlugin = "opensearch-notifications-core-" + plugin_no_snapshot + ".zip" +String notificationsRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsPlugin +String notificationsCoreRemoteFile = "https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/" + opensearch_no_snapshot + "/latest/linux/x64/tar/builds/opensearch/plugins/" + notificationsCorePlugin testClusters.integTest { testDistribution = "ARCHIVE" // Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1 @@ -115,14 +122,38 @@ testClusters.integTest { plugin(provider({ new RegularFile() { @Override - File getAsFile() { fileTree("src/test/resources/notifications-core").getSingleFile() } + File getAsFile() { + File dir = new File(rootDir.path + "/alerting/" + notificationsCoreFilePath) + + if (!dir.exists()) { + dir.mkdirs() + } + + File f = new File(dir, notificationsCorePlugin) + if (!f.exists()) { + new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} + } + fileTree(notificationsCoreFilePath).getSingleFile() + } } })) plugin(provider({ new RegularFile() { @Override - File getAsFile() { fileTree("src/test/resources/notifications").getSingleFile() } + File getAsFile() { + File dir = new File(rootDir.path + "/alerting/" + notificationsFilePath) + + if (!dir.exists()) { + dir.mkdirs() + } + + File f = new File(dir, notificationsPlugin) + if (!f.exists()) { + new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} + } + fileTree(notificationsFilePath).getSingleFile() + } } })) } @@ -170,6 +201,8 @@ integTest { String bwcVersion = "1.13.1.0" String baseName = "alertingBwcCluster" String bwcFilePath = "src/test/resources/bwc" +String bwcOpenDistroPlugin = "opendistro-alerting-" + bwcVersion + ".zip" +String bwcRemoteFile = 'https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-alerting/' + bwcOpenDistroPlugin 2.times {i -> testClusters { @@ -183,6 +216,15 @@ String bwcFilePath = "src/test/resources/bwc" return new RegularFile() { @Override File getAsFile() { + File dir = new File(rootDir.path + "/alerting/" + bwcFilePath + "/alerting/" + bwcVersion) + + if (!dir.exists()) { + dir.mkdirs() + } + File f = new File(dir, bwcOpenDistroPlugin) + if (!f.exists()) { + new URL(bwcRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} + } return fileTree(bwcFilePath + "/alerting/" + bwcVersion).getSingleFile() } } @@ -205,13 +247,37 @@ task prepareBwcTests { provider({ new RegularFile() { @Override - File getAsFile() { fileTree("src/test/resources/notifications-core").getSingleFile() } + File getAsFile() { + File dir = new File(rootDir.path + "/alerting/" + notificationsCoreFilePath) + + if (!dir.exists()) { + dir.mkdirs() + } + + File f = new File(dir, notificationsCorePlugin) + if (!f.exists()) { + new URL(notificationsCoreRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} + } + fileTree(notificationsCoreFilePath).getSingleFile() + } } }), provider({ new RegularFile() { @Override - File getAsFile() { fileTree("src/test/resources/notifications").getSingleFile() } + File getAsFile() { + File dir = new File(rootDir.path + "/alerting/" + notificationsFilePath) + + if (!dir.exists()) { + dir.mkdirs() + } + + File f = new File(dir, notificationsPlugin) + if (!f.exists()) { + new URL(notificationsRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} + } + fileTree(notificationsFilePath).getSingleFile() + } } }) ] diff --git a/alerting/src/test/resources/bwc/alerting/1.13.1.0/opendistro-alerting-1.13.1.0.zip b/alerting/src/test/resources/bwc/alerting/1.13.1.0/opendistro-alerting-1.13.1.0.zip deleted file mode 100644 index bcf25d85f..000000000 Binary files a/alerting/src/test/resources/bwc/alerting/1.13.1.0/opendistro-alerting-1.13.1.0.zip and /dev/null differ diff --git a/alerting/src/test/resources/notifications-core/opensearch-notifications-core-2.0.0.0-alpha1-SNAPSHOT.zip b/alerting/src/test/resources/notifications-core/opensearch-notifications-core-2.0.0.0-alpha1-SNAPSHOT.zip deleted file mode 100644 index 3f05bb997..000000000 Binary files a/alerting/src/test/resources/notifications-core/opensearch-notifications-core-2.0.0.0-alpha1-SNAPSHOT.zip and /dev/null differ diff --git a/alerting/src/test/resources/notifications/opensearch-notifications-2.0.0.0-alpha1-SNAPSHOT.zip b/alerting/src/test/resources/notifications/opensearch-notifications-2.0.0.0-alpha1-SNAPSHOT.zip deleted file mode 100644 index a6a63b807..000000000 Binary files a/alerting/src/test/resources/notifications/opensearch-notifications-2.0.0.0-alpha1-SNAPSHOT.zip and /dev/null differ diff --git a/build.gradle b/build.gradle index 2651c0da5..e30fced64 100644 --- a/build.gradle +++ b/build.gradle @@ -13,12 +13,15 @@ buildscript { // 2.0.0-rc1-SNAPSHOT -> 2.0.0.0-rc1-SNAPSHOT version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' + plugin_no_snapshot = opensearch_build if (buildVersionQualifier) { opensearch_build += "-${buildVersionQualifier}" + plugin_no_snapshot += "-${buildVersionQualifier}" } if (isSnapshot) { opensearch_build += "-SNAPSHOT" } + opensearch_no_snapshot = opensearch_version.replace("-SNAPSHOT","") common_utils_version = System.getProperty("common_utils.version", opensearch_build) kotlin_version = '1.6.10' }