Skip to content

Commit a2cb2a3

Browse files
CI: Eliminate redundant file wrapper (#3275)
* Plugin file wrapper Signed-off-by: Andy Kwok <[email protected]>
1 parent 3bf19ef commit a2cb2a3

File tree

1 file changed

+23
-55
lines changed

1 file changed

+23
-55
lines changed

integ-test/build.gradle

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ ext {
138138
cluster.setting name, value
139139
}
140140

141-
cluster.plugin provider((Callable<RegularFile>) (() -> (RegularFile) (() -> downloadedSecurityPlugin)))
141+
cluster.plugin provider { (RegularFile) (() -> downloadedSecurityPlugin )}
142142
}
143143

144144
bwcOpenSearchJSDownload = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + baseVersion + '/latest/linux/x64/tar/builds/' +
@@ -230,19 +230,11 @@ testClusters.all {
230230
}
231231

232232
def getJobSchedulerPlugin() {
233-
provider(new Callable<RegularFile>() {
234-
@Override
235-
RegularFile call() throws Exception {
236-
return new RegularFile() {
237-
@Override
238-
File getAsFile() {
239-
return configurations.zipArchive.asFileTree.matching {
240-
include '**/opensearch-job-scheduler*'
241-
}.singleFile
242-
}
243-
}
244-
}
245-
})
233+
provider { (RegularFile) (() ->
234+
configurations.zipArchive.asFileTree.matching {
235+
include '**/opensearch-job-scheduler*'
236+
}.singleFile )
237+
}
246238
}
247239

248240
def getGeoSpatialPlugin() {
@@ -543,37 +535,21 @@ task comparisonTest(type: RestIntegTestTask) {
543535
testDistribution = "ARCHIVE"
544536
versions = [baseVersion, opensearch_version]
545537
numberOfNodes = 3
546-
plugin(provider(new Callable<RegularFile>(){
547-
@Override
548-
RegularFile call() throws Exception {
549-
return new RegularFile() {
550-
@Override
551-
File getAsFile() {
552-
if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) {
553-
project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion"))
554-
}
555-
project.mkdir bwcJobSchedulerPath + bwcVersion
556-
ant.get(src: bwcOpenSearchJSDownload,
557-
dest: bwcJobSchedulerPath + bwcVersion,
558-
httpusecaches: false)
559-
return fileTree(bwcJobSchedulerPath + bwcVersion).getSingleFile()
560-
}
561-
}
562-
}
563-
}))
564-
plugin(provider(new Callable<RegularFile>(){
565-
@Override
566-
RegularFile call() throws Exception {
567-
return new RegularFile() {
568-
@Override
569-
File getAsFile() {
570-
return configurations.zipArchive.asFileTree.matching {
571-
include '**/opensearch-sql-plugin*'
572-
}.singleFile
573-
}
574-
}
538+
plugin(provider { (RegularFile) (() -> {
539+
if (new File("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion").exists()) {
540+
project.delete(files("$project.rootDir/$bwcFilePath/job-scheduler/$bwcVersion"))
575541
}
576-
}))
542+
project.mkdir bwcJobSchedulerPath + bwcVersion
543+
ant.get(src: bwcOpenSearchJSDownload,
544+
dest: bwcJobSchedulerPath + bwcVersion,
545+
httpusecaches: false)
546+
return fileTree(bwcJobSchedulerPath + bwcVersion).getSingleFile()
547+
})})
548+
plugin(provider { (RegularFile) (() -> {
549+
return configurations.zipArchive.asFileTree.matching {
550+
include '**/opensearch-sql-plugin*'
551+
}.singleFile
552+
})})
577553
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
578554
setting 'http.content_type.required', 'true'
579555
}
@@ -582,17 +558,9 @@ task comparisonTest(type: RestIntegTestTask) {
582558

583559
List<Provider<RegularFile>> plugins = [
584560
getJobSchedulerPlugin(),
585-
provider(new Callable<RegularFile>() {
586-
@Override
587-
RegularFile call() throws Exception {
588-
return new RegularFile() {
589-
@Override
590-
File getAsFile() {
591-
return fileTree(bwcFilePath + project.version).getSingleFile()
592-
}
593-
}
594-
}
595-
})
561+
provider { (RegularFile) (() ->
562+
fileTree(bwcFilePath + project.version).getSingleFile())
563+
}
596564
]
597565

598566
// Creates 2 test clusters with 3 nodes of the old version.

0 commit comments

Comments
 (0)