Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Introduces Centralized Resource Access Control and Sharing #5016

Draft
wants to merge 130 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
831dca3
Add a base setup for resource access evaluation
DarshitChanpura Aug 30, 2024
1c65eff
Adds handler and other access management components for resource sharing
DarshitChanpura Sep 6, 2024
118cb07
Adds sample resource plugin
DarshitChanpura Sep 6, 2024
c41b67d
Removes node_modules entry from gitingore
DarshitChanpura Sep 6, 2024
45d4fa5
Handles changes related to scope
DarshitChanpura Oct 4, 2024
ae2464d
Updates sample plugin to implement a custom scope
DarshitChanpura Oct 4, 2024
aea2253
Fixes Checkstyle and spotless issues
DarshitChanpura Oct 4, 2024
1e17dc0
Fixes initialization error
DarshitChanpura Oct 4, 2024
84746e8
Renames sample resource plugin and adds a logger statement
DarshitChanpura Oct 4, 2024
83e4da0
Changes package name for sample plugin
DarshitChanpura Oct 4, 2024
4b9b9b1
Re-organizes and renames sample plugin files
DarshitChanpura Oct 4, 2024
81216f1
Updates method references to conform to core
DarshitChanpura Oct 4, 2024
1e33dad
Fixes compile errors
DarshitChanpura Oct 4, 2024
a671cc1
Fixes some names and method implementations
DarshitChanpura Oct 14, 2024
47b73da
Adds few concrete method implementations in security plugin
DarshitChanpura Oct 14, 2024
8942a80
Adds capability to introduce index listeners for all resource plugins
DarshitChanpura Oct 15, 2024
2b06603
Removes sampleplugin to be added in a separate PR
DarshitChanpura Nov 11, 2024
6f42bf1
Updates settings.gradle
DarshitChanpura Nov 11, 2024
561e294
Adds a sample resource plugin to demonstrate resource access control …
DarshitChanpura Nov 11, 2024
45b002e
Fixes imports
DarshitChanpura Nov 20, 2024
57661e7
Cleans up create action
DarshitChanpura Nov 27, 2024
a30be57
Adds concrete implementations of remainder methods
DarshitChanpura Nov 27, 2024
d68f349
Fixes create API
DarshitChanpura Nov 27, 2024
58003f6
Fixes spotless errors
DarshitChanpura Nov 27, 2024
078a976
Fixes log statement
DarshitChanpura Nov 27, 2024
0460549
Adds Revoke API and cleans up existing APIs
DarshitChanpura Dec 3, 2024
8e44cf3
Renames ResourceManagement repository and add keyword to search query…
DarshitChanpura Dec 4, 2024
16a0ba6
Fixes delete method
DarshitChanpura Dec 4, 2024
46960ea
Adds delete API and refactors package structure
DarshitChanpura Dec 5, 2024
ac53c8f
Fixes updateByQuery painless script
DarshitChanpura Dec 5, 2024
bc67926
Updates Revoke request
DarshitChanpura Dec 5, 2024
9e6ae85
Updates revoke handler to use painless script
DarshitChanpura Dec 5, 2024
0fe9779
Convert sets to lists
DarshitChanpura Dec 5, 2024
ccd5d07
Convert sets to lists
DarshitChanpura Dec 5, 2024
bfc39ad
Adds default scopes to validation list
DarshitChanpura Dec 6, 2024
acc22c4
Fixes ClassCastException
DarshitChanpura Dec 6, 2024
6d7f4c0
Explicitly casts painless entries to set to avoid duplicates
DarshitChanpura Dec 6, 2024
9d4ca1e
Fixes revoke access script
DarshitChanpura Dec 6, 2024
b4b22d6
Fixes revoke script to handle duplicates
DarshitChanpura Dec 6, 2024
e87bb80
Updates logger statement
DarshitChanpura Dec 7, 2024
5ad813b
Adds validation for resource ownership when granting and revoking access
DarshitChanpura Dec 7, 2024
4dc7597
Adds plugin specific exception class
DarshitChanpura Dec 7, 2024
0349537
Fixes NPE
DarshitChanpura Dec 8, 2024
c08a992
Adds super-admin bypass
DarshitChanpura Dec 10, 2024
8e3d41c
Updates method names and adds missing java doc
DarshitChanpura Dec 11, 2024
334b50d
Updates method name to corresponding to changes in core
DarshitChanpura Dec 11, 2024
0f60c91
Updates API route
DarshitChanpura Dec 11, 2024
5ca5dec
Adds README
DarshitChanpura Dec 11, 2024
cabbcd6
Updates methods to return actual resources instead of resource ids
DarshitChanpura Dec 12, 2024
ca377f6
Returns actual resource when listing the resource
DarshitChanpura Dec 12, 2024
dc964ac
Stash context to fetch resources from a system index
DarshitChanpura Dec 13, 2024
cc973c6
Optimize call to fetch resources
DarshitChanpura Dec 13, 2024
3ce3d92
Updates javadoc
DarshitChanpura Dec 13, 2024
428e11e
Adds input validation
DarshitChanpura Dec 13, 2024
8845812
Updates SampleResource class structure
DarshitChanpura Dec 13, 2024
a55ac22
Adds auditlog capability and conform to changes in core
DarshitChanpura Dec 20, 2024
6269d94
Adds new scope named public
DarshitChanpura Dec 20, 2024
1c62d36
Conforms to type bounding change introduced in core
DarshitChanpura Dec 20, 2024
d8969e5
Updates Resource type
DarshitChanpura Dec 20, 2024
6a23f46
Merge remote-tracking branch 'upstream/main' into resource-access-con…
DarshitChanpura Dec 20, 2024
c24323c
Stashes context while fetching resource sharing record
DarshitChanpura Dec 20, 2024
f514859
Fixes accessDeclaredMembers error caused in AuditConfig class
DarshitChanpura Dec 20, 2024
193e846
Changes log levels and improves log statements
DarshitChanpura Dec 20, 2024
13fdb81
Bring user notion to security plugin
DarshitChanpura Dec 31, 2024
413bb0b
Conforms to changes in core
DarshitChanpura Dec 31, 2024
f566cc2
Merge remote-tracking branch 'upstream/main' into resource-access-con…
DarshitChanpura Jan 7, 2025
3ab92bb
Makes changes to conform to SPI model
DarshitChanpura Jan 7, 2025
0fe83ba
Adds an SPI Model instead of changes in core
DarshitChanpura Jan 7, 2025
9b508de
Adds a bunch of REST APIs and modifies DLS query to support resource …
DarshitChanpura Jan 8, 2025
31f3e82
Updates Resource to be an abstract class
DarshitChanpura Jan 8, 2025
b97e58c
Adds sample plugin to demonstrate resource sharing
DarshitChanpura Jan 8, 2025
bd148db
Updates scope names
DarshitChanpura Jan 8, 2025
fce2b90
Updates settings gradle to add spi
DarshitChanpura Jan 9, 2025
1aec47a
Updates DLS Search handler to filter out resources
DarshitChanpura Jan 10, 2025
11d8d6d
Updates if clause to match correctly
DarshitChanpura Jan 10, 2025
07b26b0
Updates resource tests
DarshitChanpura Jan 10, 2025
c3ad714
Merge remote-tracking branch 'origin/sample-resource-plugin-spi' into…
DarshitChanpura Jan 10, 2025
5e5c243
Changes SPI dependency visibility
DarshitChanpura Jan 10, 2025
289659f
Fixes CI errors
DarshitChanpura Jan 10, 2025
512c1a8
Fixes tests running in SSL only mode
DarshitChanpura Jan 10, 2025
85c4556
Fixes checkstyle errors
DarshitChanpura Jan 10, 2025
6849242
Merge remote-tracking branch 'upstream/main' into resource-sharing-spi
DarshitChanpura Jan 10, 2025
3e6531d
Adds featureFlag for resource sharing
DarshitChanpura Jan 13, 2025
5cab8af
Fixes spotbugsintegtest error
DarshitChanpura Jan 13, 2025
1e658e2
Merge remote-tracking branch 'upstream/main' into resource-sharing-spi
DarshitChanpura Jan 13, 2025
8366a05
Fixes SafeSerializationUtils test
DarshitChanpura Jan 13, 2025
534838f
Fix CI workflow that called assemble instead of :assemble and adds SP…
DarshitChanpura Jan 13, 2025
e1e876f
Removes Guice reference from Sample plugin and changes warn log to info
DarshitChanpura Jan 14, 2025
45e0960
Separates integration test dependencies and updates build.gradle files
DarshitChanpura Jan 15, 2025
fb0f66f
Moves unconcerned changes to a new PR
DarshitChanpura Jan 15, 2025
4b8f236
Fixes build.gradle and adds a new update APIs
DarshitChanpura Jan 15, 2025
9f9dd08
Cleans up SPI
DarshitChanpura Jan 15, 2025
ac3ef42
Refactors build gradle and renames meta-inf services and updates the …
DarshitChanpura Jan 15, 2025
5495abe
Merge remote-tracking branch 'upstream/main' into resource-sharing-spi
DarshitChanpura Jan 16, 2025
fcb5c9b
Fetches the user from newly stored persistent header
DarshitChanpura Jan 16, 2025
8bf6993
Updates parser method to use XContentParser when contructing a resour…
DarshitChanpura Jan 16, 2025
8534158
Revert :assemble change and updates build.gradle for sample-plugin
DarshitChanpura Jan 16, 2025
9826126
Adds a new type of exception for SPI
DarshitChanpura Jan 17, 2025
fe05392
Changes actionGet calls to action listeners
DarshitChanpura Jan 17, 2025
b5f2961
Adds update sample request flow
DarshitChanpura Jan 17, 2025
f862223
Updates final methods to be async calss
DarshitChanpura Jan 17, 2025
fe94573
Moves Resource sharing index constant to a new constants class
DarshitChanpura Jan 17, 2025
2bf0ba1
Uses ResourceSharingException
DarshitChanpura Jan 17, 2025
670b43e
Merge remote-tracking branch 'upstream/main' into resource-sharing-spi
DarshitChanpura Jan 17, 2025
47cb89d
Adds correct license header
DarshitChanpura Jan 17, 2025
cd49948
Fixes checkStyle violations :/
DarshitChanpura Jan 17, 2025
a215d07
Updates route names to use constant prefix
DarshitChanpura Jan 18, 2025
86d89d5
Updates dls rules and updates a failing test suite
DarshitChanpura Jan 18, 2025
485e1e8
Merge remote-tracking branch 'upstream/main' into resource-sharing-spi
DarshitChanpura Jan 18, 2025
b20cf18
Corrects enum calls
DarshitChanpura Jan 18, 2025
753d5fd
Updates the parser to have description as optional for sample resource
DarshitChanpura Jan 18, 2025
c6faed8
Adds integTest for sample-resource-plugin
DarshitChanpura Jan 18, 2025
724b15b
Fixes integrationTestRuntimeClasspath task dependency conflict
DarshitChanpura Jan 18, 2025
2f4ad39
Finalizes integration test for SampleResourcePlugin
DarshitChanpura Jan 18, 2025
41eb951
Adds test retry logic for sample-sharing-plugin
DarshitChanpura Jan 18, 2025
1d26423
Adds CI workflow that runs sample-plugin integration tests
DarshitChanpura Jan 18, 2025
2b7239a
Change painless dependency to compileOnly
DarshitChanpura Jan 18, 2025
7418bcb
Attempts to fix CI
DarshitChanpura Jan 19, 2025
a9763e9
Changes verify to post
DarshitChanpura Jan 19, 2025
6918b28
Adds a noop integration test when resource-sharing feature is disabled
DarshitChanpura Jan 19, 2025
456418e
Fixes Github workflow
DarshitChanpura Jan 19, 2025
ba6928a
Consolidates rest actions to a single place
DarshitChanpura Jan 19, 2025
a51563c
Simplifies rest actions for resource acess and updates sample plugin …
DarshitChanpura Jan 19, 2025
6e0a87b
Fixes checkStyle errors
DarshitChanpura Jan 19, 2025
a22313f
Fixes artifact and integ-test workflow
DarshitChanpura Jan 19, 2025
194fec3
Adds comment to resource access rest class and changes file name
DarshitChanpura Jan 19, 2025
bf81c46
Adds : to avoid sample-resource-plugin tests from being triggered unn…
DarshitChanpura Jan 19, 2025
6d5c80f
Fixes build-artifacts ci
DarshitChanpura Jan 19, 2025
ff56d24
Updates sample plugin readme
DarshitChanpura Jan 20, 2025
c48a02b
Removes lingering putPersistent calls
DarshitChanpura Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Separates integration test dependencies and updates build.gradle files
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Jan 15, 2025
commit 45e09606ba0308c5ca1530fe05409b717064106b
78 changes: 53 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -499,13 +499,66 @@ configurations {
force "org.checkerframework:checker-qual:3.48.4"
force "ch.qos.logback:logback-classic:1.5.16"
force "commons-io:commons-io:2.18.0"
force "com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2"
force "org.hamcrest:hamcrest:2.2"
force "org.mockito:mockito-core:5.15.2"
force "net.bytebuddy:byte-buddy:1.15.11"
}
}

integrationTestImplementation.extendsFrom implementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
}

allprojects {
configurations {
integrationTestImplementation.extendsFrom implementation
}
dependencies {
//integration test framework:
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2') {
exclude(group: 'junit', module: 'junit')
}
integrationTestImplementation 'junit:junit:4.13.2'
integrationTestImplementation("org.opensearch.plugin:reindex-client:${opensearch_version}"){
exclude(group: 'org.slf4j', module: 'slf4j-api')
}
integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}"
integrationTestImplementation 'commons-io:commons-io:2.18.0'
integrationTestImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
integrationTestImplementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}"
integrationTestImplementation 'org.hamcrest:hamcrest:2.2'
integrationTestImplementation "org.bouncycastle:bcpkix-jdk18on:${versions.bouncycastle}"
integrationTestImplementation "org.bouncycastle:bcutil-jdk18on:${versions.bouncycastle}"
integrationTestImplementation('org.awaitility:awaitility:4.2.2') {
exclude(group: 'org.hamcrest', module: 'hamcrest')
}
integrationTestImplementation 'com.unboundid:unboundid-ldapsdk:4.0.14'
integrationTestImplementation "org.opensearch.plugin:mapper-size:${opensearch_version}"
integrationTestImplementation "org.apache.httpcomponents:httpclient-cache:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpclient:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:fluent-hc:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpcore:4.4.16"
integrationTestImplementation "org.apache.httpcomponents:httpasyncclient:4.1.5"
integrationTestImplementation "org.mockito:mockito-core:5.15.2"
integrationTestImplementation "org.passay:passay:1.6.6"
integrationTestImplementation "org.opensearch:opensearch:${opensearch_version}"
integrationTestImplementation "org.opensearch.plugin:transport-netty4-client:${opensearch_version}"
integrationTestImplementation "org.opensearch.plugin:aggs-matrix-stats-client:${opensearch_version}"
integrationTestImplementation "org.opensearch.plugin:parent-join-client:${opensearch_version}"
integrationTestImplementation 'com.password4j:password4j:1.8.2'
integrationTestImplementation "com.google.guava:guava:${guava_version}"
integrationTestImplementation "org.apache.commons:commons-lang3:${versions.commonslang}"
integrationTestImplementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}"
integrationTestImplementation 'org.greenrobot:eventbus-java:3.3.1'
integrationTestImplementation('com.flipkart.zjsonpatch:zjsonpatch:0.4.16'){
exclude(group:'com.fasterxml.jackson.core')
}
integrationTestImplementation 'org.slf4j:slf4j-api:2.0.12'
integrationTestImplementation 'com.selectivem.collections:special-collections-complete:1.4.0'
}
}

//create source set 'integrationTest'
//add classes from the main source set to the compilation and runtime classpaths of the integrationTest
sourceSets {
@@ -724,31 +777,6 @@ dependencies {

compileOnly "org.opensearch:opensearch:${opensearch_version}"

//integration test framework:
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2') {
exclude(group: 'junit', module: 'junit')
}
integrationTestImplementation 'junit:junit:4.13.2'
integrationTestImplementation "org.opensearch.plugin:reindex-client:${opensearch_version}"
integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}"
integrationTestImplementation 'commons-io:commons-io:2.18.0'
integrationTestImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
integrationTestImplementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}"
integrationTestImplementation 'org.hamcrest:hamcrest:2.2'
integrationTestImplementation "org.bouncycastle:bcpkix-jdk18on:${versions.bouncycastle}"
integrationTestImplementation "org.bouncycastle:bcutil-jdk18on:${versions.bouncycastle}"
integrationTestImplementation('org.awaitility:awaitility:4.2.2') {
exclude(group: 'org.hamcrest', module: 'hamcrest')
}
integrationTestImplementation 'com.unboundid:unboundid-ldapsdk:4.0.14'
integrationTestImplementation "org.opensearch.plugin:mapper-size:${opensearch_version}"
integrationTestImplementation "org.apache.httpcomponents:httpclient-cache:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpclient:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:fluent-hc:4.5.14"
integrationTestImplementation "org.apache.httpcomponents:httpcore:4.4.16"
integrationTestImplementation "org.apache.httpcomponents:httpasyncclient:4.1.5"
integrationTestImplementation "org.mockito:mockito-core:5.15.2"

//spotless
implementation('com.google.googlejavaformat:google-java-format:1.25.2') {
exclude group: 'com.google.guava'
172 changes: 41 additions & 131 deletions sample-resource-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -5,9 +5,6 @@

apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.java-rest-test'

import org.opensearch.gradle.test.RestIntegTestTask

java {
sourceCompatibility = JavaVersion.VERSION_21
@@ -20,8 +17,13 @@ opensearchplugin {
classname 'org.opensearch.sample.SampleResourcePlugin'
}

dependencyLicenses.enabled = false
thirdPartyAudit.enabled = false
loggerUsageCheck.enabled = false
tasks.test.enabled=false
validateNebulaPom.enabled=false

ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE.txt')
noticeFile = rootProject.file('NOTICE.txt')
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
@@ -31,7 +33,6 @@ ext {
version_tokens = opensearch_version.tokenize('-')
opensearch_build = version_tokens[0] + '.0'


if (buildVersionQualifier) {
opensearch_build += "-${buildVersionQualifier}"
}
@@ -46,144 +47,53 @@ repositories {
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
}

configurations.all {
resolutionStrategy {
force 'com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2',
'org.hamcrest:hamcrest:2.2',
'org.apache.httpcomponents:httpclient:4.5.14',
'org.apache.httpcomponents:httpcore:4.4.16',
'org.mockito:mockito-core:5.15.2',
'net.bytebuddy:byte-buddy:1.15.11',
'commons-codec:commons-codec:1.16.1',
'com.fasterxml.jackson.core:jackson-databind:2.18.2',
'com.fasterxml.jackson.core:jackson-databind:2.18.2'
}
}

dependencies {
// Main implementation dependencies
implementation "org.opensearch:opensearch-resource-sharing-spi:${opensearch_build}"
implementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}"
}

dependencyLicenses.enabled = false
thirdPartyAudit.enabled = false

def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile
es_tmp_dir.mkdirs()

File repo = file("$buildDir/testclusters/repo")
def _numNodes = findProperty('numNodes') as Integer ?: 1

licenseHeaders.enabled = true
validateNebulaPom.enabled = false
testingConventions.enabled = false
loggerUsageCheck.enabled = false

javaRestTest.dependsOn(rootProject.assemble)
javaRestTest {
systemProperty 'tests.security.manager', 'false'
// Integration test dependencies
integrationTestImplementation rootProject.sourceSets.integrationTest.output
integrationTestImplementation rootProject.sourceSets.main.output
}
testClusters.javaRestTest {
testDistribution = 'INTEG_TEST'
}

task integTest(type: RestIntegTestTask) {
description = "Run tests against a cluster"
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
}
tasks.named("check").configure { dependsOn(integTest) }

integTest {
if (project.hasProperty('excludeTests')) {
project.properties['excludeTests']?.replaceAll('\\s', '')?.split('[,;]')?.each {
exclude "${it}"
}
}
systemProperty 'tests.security.manager', 'false'
systemProperty 'java.io.tmpdir', es_tmp_dir.absolutePath

systemProperty "https", System.getProperty("https")
systemProperty "user", System.getProperty("user")
systemProperty "password", System.getProperty("password")
// Tell the test JVM if the cluster JVM is running under a debugger so that tests can use longer timeouts for
// requests. The 'doFirst' delays reading the debug setting on the cluster till execution time.
doFirst {
// Tell the test JVM if the cluster JVM is running under a debugger so that tests can
// use longer timeouts for requests.
def isDebuggingCluster = getDebug() || System.getProperty("test.debug") != null
systemProperty 'cluster.debug', isDebuggingCluster
// Set number of nodes system property to be used in tests
systemProperty 'cluster.number_of_nodes', "${_numNodes}"
// There seems to be an issue when running multi node run or integ tasks with unicast_hosts
// not being written, the waitForAllConditions ensures it's written
getClusters().forEach { cluster ->
cluster.waitForAllConditions()
}
}

// The -Dcluster.debug option makes the cluster debuggable; this makes the tests debuggable
if (System.getProperty("test.debug") != null) {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=8000'
}
if (System.getProperty("tests.rest.bwcsuite") == null) {
filter {
excludeTestsMatching "org.opensearch.security.sampleextension.bwc.*IT"
sourceSets {
integrationTest {
java {
srcDir file('src/integrationTest/java')
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
}
project.getTasks().getByName('bundlePlugin').dependsOn(rootProject.tasks.getByName('build'))
Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin");
Zip rootBundle = (Zip) rootProject.getTasks().getByName("bundlePlugin");
integTest.dependsOn(bundle)
integTest.getClusters().forEach{c -> {
c.plugin(rootProject.getObjects().fileProperty().value(rootBundle.getArchiveFile()))
c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))
}}

testClusters.integTest {
testDistribution = 'INTEG_TEST'

// Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1
if (_numNodes > 1) numberOfNodes = _numNodes
// When running integration tests it doesn't forward the --debug-jvm to the cluster anymore
// i.e. we have to use a custom property to flag when we want to debug OpenSearch JVM
// since we also support multi node integration tests we increase debugPort per node
if (System.getProperty("cluster.debug") != null) {
def debugPort = 5005
nodes.forEach { node ->
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=*:${debugPort}")
debugPort += 1
resources {
srcDir file('src/integrationTest/resources')
}
}
setting 'path.repo', repo.absolutePath
}

afterEvaluate {
testClusters.integTest.nodes.each { node ->
def plugins = node.plugins
def firstPlugin = plugins.get(0)
if (firstPlugin.provider == project.bundlePlugin.archiveFile) {
plugins.remove(0)
plugins.add(firstPlugin)
}
tasks.register("integrationTest", Test) {
description = 'Run integration tests for the subproject.'
group = 'verification'

testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath

node.extraConfigFile("kirk.pem", file("src/test/resources/security/kirk.pem"))
node.extraConfigFile("kirk-key.pem", file("src/test/resources/security/kirk-key.pem"))
node.extraConfigFile("esnode.pem", file("src/test/resources/security/esnode.pem"))
node.extraConfigFile("esnode-key.pem", file("src/test/resources/security/esnode-key.pem"))
node.extraConfigFile("root-ca.pem", file("src/test/resources/security/root-ca.pem"))
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
node.setting("plugins.security.ssl.transport.enforce_hostname_verification", "false")
node.setting("plugins.security.ssl.http.enabled", "true")
node.setting("plugins.security.ssl.http.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.http.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.http.pemtrustedcas_filepath", "root-ca.pem")
node.setting("plugins.security.allow_unsafe_democertificates", "true")
node.setting("plugins.security.allow_default_init_securityindex", "true")
node.setting("plugins.security.authcz.admin_dn", "\n - CN=kirk,OU=client,O=client,L=test,C=de")
node.setting("plugins.security.audit.type", "internal_opensearch")
node.setting("plugins.security.enable_snapshot_restore_privilege", "true")
node.setting("plugins.security.check_snapshot_restore_write_privileges", "true")
node.setting("plugins.security.restapi.roles_enabled", "[\"all_access\", \"security_rest_api_access\"]")
}
}

run {
doFirst {
// There seems to be an issue when running multi node run or integ tasks with unicast_hosts
// not being written, the waitForAllConditions ensures it's written
getClusters().forEach { cluster ->
cluster.waitForAllConditions()
}
}
useCluster testClusters.integTest
// Ensure integrationTest task depends on the root project's compile task
tasks.named("integrationTest").configure {
dependsOn rootProject.tasks.named("compileIntegrationTestJava")
}
1 change: 0 additions & 1 deletion spi/build.gradle
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ repositories {

dependencies {
compileOnly "org.opensearch:opensearch:${opensearch_version}"
testImplementation "org.opensearch.test:framework:${opensearch_version}"
}

java {