@@ -10,7 +10,6 @@ import java.util.concurrent.Callable
1010import java.util.concurrent.TimeUnit
1111import java.util.function.Predicate
1212
13-
1413buildscript {
1514 ext {
1615 isSnapshot = " true" == System . getProperty(" build.snapshot" , " true" )
@@ -21,16 +20,19 @@ buildscript {
2120 opensearch_build = version_tokens[0 ] + ' .0'
2221 job_scheduler_no_snapshot = opensearch_build
2322 notifications_no_snapshot = opensearch_build
23+ security_no_snapshot = opensearch_build
2424 if (buildVersionQualifier) {
2525 opensearch_build + = " -${ buildVersionQualifier} "
2626 job_scheduler_no_snapshot + = " -${ buildVersionQualifier} "
2727 notifications_no_snapshot + = " -${ buildVersionQualifier} "
28+ security_no_snapshot = " -${ buildVersionQualifier} "
2829 }
2930 if (isSnapshot) {
3031 opensearch_build + = " -SNAPSHOT"
3132 }
32- opensearch_no_snapshot = opensearch_version. replace(" -SNAPSHOT" ," " )
33+ opensearch_no_snapshot = opensearch_version. replace(" -SNAPSHOT" , " " )
3334 job_scheduler_resource_folder = " src/test/resources/job-scheduler"
35+ security_resource_folder = " src/test/resources/security"
3436
3537 notifications_resource_folder = " src/test/resources/notifications"
3638 notifications_core_resource_folder = " src/test/resources/notifications-core"
@@ -39,6 +41,9 @@ buildscript {
3941 job_scheduler_version = System . getProperty(" job_scheduler_version.version" , opensearch_build)
4042 job_scheduler_build_download = ' https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot +
4143 ' /latest/linux/x64/tar/builds/opensearch/plugins/opensearch-job-scheduler-' + job_scheduler_no_snapshot + ' .zip'
44+ security_version = System . getProperty(" security.version" , opensearch_build)
45+ secuirty_build_download = ' https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot +
46+ ' /latest/linux/x64/tar/builds/opensearch/plugins/opensearch-security-' + security_no_snapshot + ' .zip'
4247 notifications_version = System . getProperty(" notifications.version" , opensearch_build)
4348 notifications_build_download = ' https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot +
4449 ' /latest/linux/x64/tar/builds/opensearch/plugins/opensearch-notifications-' + notifications_no_snapshot + ' .zip'
@@ -271,7 +276,6 @@ afterEvaluate {
271276 node. setting(" plugins.security.check_snapshot_restore_write_privileges" , " true" )
272277 node. setting(" plugins.security.restapi.roles_enabled" , " [\" all_access\" , \" security_rest_api_access\" ]" )
273278 node. setting(" plugins.security.system_indices.enabled" , " true" )
274- // node.setting("plugins.security.system_indices.indices", "[\".opendistro-ism-config\"]")
275279 }
276280 }
277281}
@@ -307,7 +311,7 @@ testClusters.integTest {
307311 }
308312 }
309313
310- plugin(provider(new Callable<RegularFile > (){
314+ plugin(provider(new Callable<RegularFile > () {
311315 @Override
312316 RegularFile call () throws Exception {
313317 return new RegularFile () {
@@ -326,7 +330,7 @@ testClusters.integTest {
326330 }
327331 }))
328332
329- plugin(provider(new Callable<RegularFile > (){
333+ plugin(provider(new Callable<RegularFile > () {
330334 @Override
331335 RegularFile call () throws Exception {
332336 return new RegularFile () {
@@ -345,7 +349,7 @@ testClusters.integTest {
345349 }
346350 }))
347351
348- plugin(provider(new Callable<RegularFile > (){
352+ plugin(provider(new Callable<RegularFile > () {
349353 @Override
350354 RegularFile call () throws Exception {
351355 return new RegularFile () {
@@ -365,10 +369,25 @@ testClusters.integTest {
365369 }))
366370
367371 if (securityEnabled) {
368- plugin(provider({
369- new RegularFile () {
370- @Override
371- File getAsFile () { fileTree(" src/test/resources/security" ) { include " opensearch-security*" }. getSingleFile() }
372+ plugin(provider(new Callable<RegularFile > () {
373+ @Override
374+ RegularFile call () throws Exception {
375+ return new RegularFile () {
376+ @Override
377+ File getAsFile () {
378+ if (new File (" $project . rootDir /$security_resource_folder /opensearch-security-$security_no_snapshot " + " .zip" ). exists()) {
379+ project. delete(files(" $project . rootDir /$security_resource_folder /opensearch-security-$security_no_snapshot " + " .zip" ))
380+ }
381+ if (new File (" $project . rootDir /$security_resource_folder " ). exists() == false ) {
382+ project. mkdir security_resource_folder
383+ }
384+
385+ ant. get(src : secuirty_build_download,
386+ dest : security_resource_folder,
387+ httpusecaches : false )
388+ return fileTree(security_resource_folder) { include " opensearch-security*" }. getSingleFile()
389+ }
390+ }
372391 }
373392 }))
374393 }
@@ -414,13 +433,20 @@ integTest {
414433 }
415434 }
416435
436+ // run the test only if security is enabled
437+ if (! securityEnabled) {
438+ filter {
439+ excludeTestsMatching " org.opensearch.indexmanagement.SecurityBehaviorIT"
440+ }
441+ }
442+
417443 // TODO: raise issue in Core, this is because of the test framework
418444 if (System . getProperty(" tests.clustername" ) != null ) {
419445 exclude ' org/opensearch/indexmanagement/indexstatemanagement/MetadataRegressionIT.class'
420446 }
421447}
422448
423- task integTestRemote (type : RestIntegTestTask ) {
449+ task integTestRemote (type : RestIntegTestTask ) {
424450 testClassesDirs = sourceSets. test. output. classesDirs
425451 classpath = sourceSets. test. runtimeClasspath
426452 systemProperty ' tests.security.manager' , ' false'
@@ -466,13 +492,13 @@ String bwc_im_download_url = "https://github.com/opendistro-for-elasticsearch/in
466492 bwcVersion + " /index-management-artifacts.zip"
467493getPluginResource(bwc_im_resource_location, bwc_im_download_url)
468494
469- 2. times {i ->
495+ 2. times { i ->
470496 testClusters {
471497 " ${ baseName} $i " {
472498 testDistribution = " ARCHIVE"
473499 versions = [" 7.10.2" , opensearch_version]
474500 numberOfNodes = 3
475- plugin(provider(new Callable<RegularFile > (){
501+ plugin(provider(new Callable<RegularFile > () {
476502 @Override
477503 RegularFile call () throws Exception {
478504 return new RegularFile () {
@@ -484,7 +510,7 @@ getPluginResource(bwc_im_resource_location, bwc_im_download_url)
484510 }
485511 }))
486512
487- plugin(provider(new Callable<RegularFile > (){
513+ plugin(provider(new Callable<RegularFile > () {
488514 @Override
489515 RegularFile call () throws Exception {
490516 return new RegularFile () {
@@ -511,7 +537,7 @@ task prepareBwcTests {
511537 // Download the job scheduler test dependency
512538 getPluginResource(job_scheduler_resource_folder, job_scheduler_build_download)
513539 plugins = [
514- provider(new Callable<RegularFile > (){
540+ provider(new Callable<RegularFile > () {
515541 @Override
516542 RegularFile call () throws Exception {
517543 return new RegularFile () {
@@ -528,7 +554,7 @@ task prepareBwcTests {
528554}
529555
530556// Create two test clusters with 3 nodes of the old version
531- 2. times {i ->
557+ 2. times { i ->
532558 task " ${ baseName} #oldVersionClusterTask$i " (type : StandaloneRestIntegTestTask ) {
533559 dependsOn ' prepareBwcTests'
534560 useCluster testClusters. " ${ baseName} $i "
@@ -669,6 +695,13 @@ testClusters.mixedCluster {
669695 }
670696 }))
671697
698+ node. plugin(provider({
699+ new RegularFile () {
700+ @Override
701+ File getAsFile () { fileTree(security_resource_folder). getSingleFile() }
702+ }
703+ }))
704+
672705 node. plugin(provider({
673706 new RegularFile () {
674707 @Override
0 commit comments