From a2cb2a3809fcca76b3eea322c01cea8764850bbd Mon Sep 17 00:00:00 2001 From: Andy Kwok Date: Fri, 31 Jan 2025 12:59:56 -0800 Subject: [PATCH] CI: Eliminate redundant file wrapper (#3275) * Plugin file wrapper Signed-off-by: Andy Kwok --- integ-test/build.gradle | 78 ++++++++++++----------------------------- 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/integ-test/build.gradle b/integ-test/build.gradle index d060e564f5..91ecaa0f6f 100644 --- a/integ-test/build.gradle +++ b/integ-test/build.gradle @@ -138,7 +138,7 @@ ext { cluster.setting name, value } - cluster.plugin provider((Callable) (() -> (RegularFile) (() -> downloadedSecurityPlugin))) + cluster.plugin provider { (RegularFile) (() -> downloadedSecurityPlugin )} } bwcOpenSearchJSDownload = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + baseVersion + '/latest/linux/x64/tar/builds/' + @@ -230,19 +230,11 @@ testClusters.all { } def getJobSchedulerPlugin() { - provider(new Callable() { - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return configurations.zipArchive.asFileTree.matching { - include '**/opensearch-job-scheduler*' - }.singleFile - } - } - } - }) + provider { (RegularFile) (() -> + configurations.zipArchive.asFileTree.matching { + include '**/opensearch-job-scheduler*' + }.singleFile ) + } } def getGeoSpatialPlugin() { @@ -543,37 +535,21 @@ task comparisonTest(type: RestIntegTestTask) { testDistribution = "ARCHIVE" versions = [baseVersion, opensearch_version] numberOfNodes = 3 - plugin(provider(new Callable(){ - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) { - project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion")) - } - project.mkdir bwcJobSchedulerPath + bwcVersion - ant.get(src: bwcOpenSearchJSDownload, - dest: bwcJobSchedulerPath + bwcVersion, - httpusecaches: false) - return fileTree(bwcJobSchedulerPath + bwcVersion).getSingleFile() - } - } - } - })) - plugin(provider(new Callable(){ - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return configurations.zipArchive.asFileTree.matching { - include '**/opensearch-sql-plugin*' - }.singleFile - } - } + plugin(provider { (RegularFile) (() -> { + if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) { + project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion")) } - })) + project.mkdir bwcJobSchedulerPath + bwcVersion + ant.get(src: bwcOpenSearchJSDownload, + dest: bwcJobSchedulerPath + bwcVersion, + httpusecaches: false) + return fileTree(bwcJobSchedulerPath + bwcVersion).getSingleFile() + })}) + plugin(provider { (RegularFile) (() -> { + return configurations.zipArchive.asFileTree.matching { + include '**/opensearch-sql-plugin*' + }.singleFile + })}) setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}" setting 'http.content_type.required', 'true' } @@ -582,17 +558,9 @@ task comparisonTest(type: RestIntegTestTask) { List> plugins = [ getJobSchedulerPlugin(), - provider(new Callable() { - @Override - RegularFile call() throws Exception { - return new RegularFile() { - @Override - File getAsFile() { - return fileTree(bwcFilePath + project.version).getSingleFile() - } - } - } - }) + provider { (RegularFile) (() -> + fileTree(bwcFilePath + project.version).getSingleFile()) + } ] // Creates 2 test clusters with 3 nodes of the old version.