diff --git a/build.gradle b/build.gradle index 92cb6f19..570b1145 100644 --- a/build.gradle +++ b/build.gradle @@ -212,9 +212,21 @@ task integTestRemote(type: RestIntegTestTask) { } } + +ext.getPluginResource = { download_to_folder, download_from_src -> + project.mkdir download_to_folder + ant.get(src: download_from_src, + dest: download_to_folder, + httpusecaches: false) + return fileTree(download_to_folder).getSingleFile() +} + String baseName = "asynSearchCluster" +String bwcVersion = "1.13.0.1" String bwcFilePath = "src/test/resources/org/opensearch/search/asynchronous/bwc/" - +String bwcRemoteFile = "https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-asynchronous-search/opendistro-asynchronous-search-1.13.0.1.zip" +String bwcOpenDistroPlugin = "opendistro-asynchronous-search-1.13.0.1.zip" +getPluginResource(bwcFilePath + bwcVersion, bwcRemoteFile) // Creates two test clusters of previous version and loads opensearch plugin of bwcVersion 2.times { i -> testClusters { @@ -228,6 +240,14 @@ String bwcFilePath = "src/test/resources/org/opensearch/search/asynchronous/bwc/ return new RegularFile() { @Override File getAsFile() { +// File dir = new File(bwcFilePath + bwcVersion) +// if (!dir.exists()) { +// dir.mkdirs() +// } +// File f = new File(bwcFilePath + bwcVersion + "/" + bwcOpenDistroPlugin) +// if (!f.exists()) { +// new URL(bwcRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} +// } return fileTree(bwcFilePath + opendistro_plugin_version).getSingleFile() } } @@ -249,6 +269,14 @@ List> plugins = [ return new RegularFile() { @Override File getAsFile() { + File dir = new File(bwcFilePath + bwcVersion) + if (!dir.exists()) { + dir.mkdirs() + } + File f = new File(bwcFilePath + bwcVersion + "/" + bwcOpenDistroPlugin) + if (!f.exists()) { + new URL(bwcRemoteFile).withInputStream{ ins -> f.withOutputStream{ it << ins }} + } return fileTree(bwcFilePath + project.version).getSingleFile() } } diff --git a/src/test/resources/org/opensearch/search/asynchronous/bwc/1.13.0.1/opendistro-asynchronous-search-1.13.0.1.zip b/src/test/resources/org/opensearch/search/asynchronous/bwc/1.13.0.1/opendistro-asynchronous-search-1.13.0.1.zip deleted file mode 100644 index fd401973..00000000 Binary files a/src/test/resources/org/opensearch/search/asynchronous/bwc/1.13.0.1/opendistro-asynchronous-search-1.13.0.1.zip and /dev/null differ