@@ -48,6 +48,7 @@ apply plugin: 'com.wiredforcode.spawn'
4848
4949
5050repositories {
51+ mavenLocal()
5152 mavenCentral()
5253 maven { url ' https://jitpack.io' }
5354
6263 licenseFile = rootProject. file(' LICENSE.TXT' )
6364 noticeFile = rootProject. file(' NOTICE' )
6465
65- getSecurityPluginDownloadLink = { ->
66- var repo = " https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/" +
67- " opensearch-security/$opensearch_build_snapshot /"
68- var metadataFile = Paths . get(projectDir. toString(), " build" , " maven-metadata.xml" ). toAbsolutePath(). toFile()
69- download. run {
70- src repo + " maven-metadata.xml"
71- dest metadataFile
72- }
73- def metadata = new XmlParser (). parse(metadataFile)
74- def securitySnapshotVersion = metadata. versioning. snapshotVersions[0 ]. snapshotVersion[0 ]. value[0 ]. text()
75-
76- return repo + " opensearch-security-${ securitySnapshotVersion} .zip"
77- }
78-
7966 var projectAbsPath = projectDir. getAbsolutePath()
80- File downloadedSecurityPlugin = Paths . get(projectAbsPath, ' bin' , ' opensearch-security-snapshot.zip' ). toFile()
8167 configureSecurityPlugin = { OpenSearchCluster cluster ->
8268
8369 cluster. getNodes(). forEach { node ->
8975 }
9076 }
9177
92- // add a check to avoid re-downloading multiple times during single test run
93- if (! downloadedSecurityPlugin. exists()) {
94- download. run {
95- src getSecurityPluginDownloadLink()
96- dest downloadedSecurityPlugin
97- }
98- } else {
99- println " Security Plugin File Already Exists"
100- }
101-
10278 // Config below including files are copied from security demo configuration
10379 [' esnode.pem' , ' esnode-key.pem' , ' root-ca.pem' ]. forEach { file ->
10480 File local = Paths . get(projectAbsPath, ' bin' , file). toFile()
@@ -132,8 +108,6 @@ ext {
132108 ]. forEach { name , value ->
133109 cluster. setting name, value
134110 }
135-
136- cluster. plugin provider((Callable<RegularFile > ) (() -> (RegularFile ) (() -> downloadedSecurityPlugin)))
137111 }
138112
139113 bwcFilePath = " src/test/resources/bwc/"
@@ -227,6 +201,22 @@ def getJobSchedulerPlugin() {
227201 })
228202}
229203
204+ def getSecurityPlugin () {
205+ provider(new Callable<RegularFile > () {
206+ @Override
207+ RegularFile call () throws Exception {
208+ return new RegularFile () {
209+ @Override
210+ File getAsFile () {
211+ return configurations. zipArchive. asFileTree. matching {
212+ include ' **/opensearch-security*'
213+ }. singleFile
214+ }
215+ }
216+ }
217+ })
218+ }
219+
230220testClusters {
231221 integTest {
232222 testDistribution = ' archive'
@@ -242,11 +232,13 @@ testClusters {
242232 integTestWithSecurity {
243233 testDistribution = ' archive'
244234 plugin(getJobSchedulerPlugin())
235+ plugin(getSecurityPlugin())
245236 plugin " :opensearch-sql-plugin"
246237 }
247238 remoteIntegTestWithSecurity {
248239 testDistribution = ' archive'
249240 plugin(getJobSchedulerPlugin())
241+ plugin(getSecurityPlugin())
250242 plugin " :opensearch-sql-plugin"
251243 }
252244}
0 commit comments