Skip to content

Commit d5ee441

Browse files
Add integration tests for analytics engine index-level authorization (#5462)
1 parent 51bece3 commit d5ee441

2 files changed

Lines changed: 479 additions & 2 deletions

File tree

integ-test/build.gradle

Lines changed: 132 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ ext.pluginVersion = opensearch_version.tokenize('-')[0]
276276
ext.featureBuildBase = "https://ci.opensearch.org/ci/dbc/feature-build-opensearch/feature-datafusion/latest/linux/x64/tar/builds/opensearch/plugins"
277277
ext.analyticsEngineZipDest = "${buildDir}/distributions/analytics-engine-${pluginVersion}-SNAPSHOT.zip"
278278
ext.arrowFlightRpcZipDest = "${buildDir}/distributions/arrow-flight-rpc-${pluginVersion}-SNAPSHOT.zip"
279+
ext.arrowBaseZipDest = "${buildDir}/distributions/arrow-base-${pluginVersion}-SNAPSHOT.zip"
280+
ext.testPplFrontendZipDest = "${buildDir}/distributions/test-ppl-frontend-${pluginVersion}-SNAPSHOT.zip"
281+
ext.analyticsBackendLuceneZipDest = "${buildDir}/distributions/analytics-backend-lucene-${pluginVersion}-SNAPSHOT.zip"
282+
ext.parquetDataFormatZipDest = "${buildDir}/distributions/parquet-data-format-${pluginVersion}-SNAPSHOT.zip"
283+
ext.compositeEngineZipDest = "${buildDir}/distributions/composite-engine-${pluginVersion}-SNAPSHOT.zip"
284+
ext.analyticsBackendDatafusionZipDest = "${buildDir}/distributions/analytics-backend-datafusion-${pluginVersion}-SNAPSHOT.zip"
279285

280286
task downloadAnalyticsEngineZip(type: Download) {
281287
src "${featureBuildBase}/1-analytics-engine-${pluginVersion}.zip"
@@ -286,13 +292,61 @@ task downloadAnalyticsEngineZip(type: Download) {
286292
}
287293

288294
task downloadArrowFlightRpcZip(type: Download) {
289-
src "${featureBuildBase}/0-arrow-flight-rpc-${pluginVersion}.zip"
295+
src "${featureBuildBase}/0-2-arrow-flight-rpc-${pluginVersion}.zip"
290296
dest arrowFlightRpcZipDest
291297
overwrite false
292298
onlyIfModified true
293299
onlyIf { !project.findProperty('arrowFlightRpcZip') }
294300
}
295301

302+
task downloadArrowBaseZip(type: Download) {
303+
src "${featureBuildBase}/0-1-arrow-base-${pluginVersion}.zip"
304+
dest arrowBaseZipDest
305+
overwrite false
306+
onlyIfModified true
307+
onlyIf { !project.findProperty('arrowBaseZip') }
308+
}
309+
310+
task downloadTestPplFrontendZip(type: Download) {
311+
src "${featureBuildBase}/1-test-ppl-frontend-${pluginVersion}.zip"
312+
dest testPplFrontendZipDest
313+
overwrite false
314+
onlyIfModified true
315+
onlyIf { !project.findProperty('testPplFrontendZip') }
316+
}
317+
318+
task downloadAnalyticsBackendLuceneZip(type: Download) {
319+
src "${featureBuildBase}/1-analytics-backend-lucene-${pluginVersion}.zip"
320+
dest analyticsBackendLuceneZipDest
321+
overwrite false
322+
onlyIfModified true
323+
onlyIf { !project.findProperty('analyticsBackendLuceneZip') }
324+
}
325+
326+
task downloadParquetDataFormatZip(type: Download) {
327+
src "${featureBuildBase}/1-parquet-data-format-${pluginVersion}.zip"
328+
dest parquetDataFormatZipDest
329+
overwrite false
330+
onlyIfModified true
331+
onlyIf { !project.findProperty('parquetDataFormatZip') }
332+
}
333+
334+
task downloadCompositeEngineZip(type: Download) {
335+
src "${featureBuildBase}/1-composite-engine-${pluginVersion}.zip"
336+
dest compositeEngineZipDest
337+
overwrite false
338+
onlyIfModified true
339+
onlyIf { !project.findProperty('compositeEngineZip') }
340+
}
341+
342+
task downloadAnalyticsBackendDatafusionZip(type: Download) {
343+
src "${featureBuildBase}/1-analytics-backend-datafusion-${pluginVersion}.zip"
344+
dest analyticsBackendDatafusionZipDest
345+
overwrite false
346+
onlyIfModified true
347+
onlyIf { !project.findProperty('analyticsBackendDatafusionZip') }
348+
}
349+
296350
def getAnalyticsEnginePlugin() {
297351
provider { (RegularFile) (() -> file(project.findProperty('analyticsEngineZip') ?: analyticsEngineZipDest)) }
298352
}
@@ -301,6 +355,30 @@ def getArrowFlightRpcPlugin() {
301355
provider { (RegularFile) (() -> file(project.findProperty('arrowFlightRpcZip') ?: arrowFlightRpcZipDest)) }
302356
}
303357

358+
def getArrowBasePlugin() {
359+
provider { (RegularFile) (() -> file(project.findProperty('arrowBaseZip') ?: arrowBaseZipDest)) }
360+
}
361+
362+
def getTestPplFrontendPlugin() {
363+
provider { (RegularFile) (() -> file(project.findProperty('testPplFrontendZip') ?: testPplFrontendZipDest)) }
364+
}
365+
366+
def getAnalyticsBackendLucenePlugin() {
367+
provider { (RegularFile) (() -> file(project.findProperty('analyticsBackendLuceneZip') ?: analyticsBackendLuceneZipDest)) }
368+
}
369+
370+
def getParquetDataFormatPlugin() {
371+
provider { (RegularFile) (() -> file(project.findProperty('parquetDataFormatZip') ?: parquetDataFormatZipDest)) }
372+
}
373+
374+
def getCompositeEnginePlugin() {
375+
provider { (RegularFile) (() -> file(project.findProperty('compositeEngineZip') ?: compositeEngineZipDest)) }
376+
}
377+
378+
def getAnalyticsBackendDatafusionPlugin() {
379+
provider { (RegularFile) (() -> file(project.findProperty('analyticsBackendDatafusionZip') ?: analyticsBackendDatafusionZipDest)) }
380+
}
381+
304382
testClusters {
305383
integTest {
306384
testDistribution = 'archive'
@@ -336,6 +414,7 @@ testClusters {
336414
analyticsEngineCompat {
337415
testDistribution = 'archive'
338416
plugin(getJobSchedulerPlugin())
417+
plugin(getArrowBasePlugin())
339418
plugin(getArrowFlightRpcPlugin())
340419
plugin(getAnalyticsEnginePlugin())
341420
plugin ":opensearch-sql-plugin"
@@ -392,13 +471,59 @@ stopPrometheus.mustRunAfter startPrometheus
392471

393472
task analyticsEngineCompatIT(type: RestIntegTestTask) {
394473
useCluster testClusters.analyticsEngineCompat
395-
dependsOn downloadAnalyticsEngineZip, downloadArrowFlightRpcZip
474+
dependsOn downloadAnalyticsEngineZip, downloadArrowFlightRpcZip, downloadArrowBaseZip
396475
systemProperty 'tests.security.manager', 'false'
397476
filter {
398477
includeTestsMatching 'org.opensearch.sql.plugin.AnalyticsEngineCompatIT'
399478
}
400479
}
401480

481+
task analyticsEngineSecurityIT(type: RestIntegTestTask) {
482+
dependsOn downloadAnalyticsEngineZip, downloadArrowFlightRpcZip, downloadArrowBaseZip, downloadAnalyticsBackendLuceneZip, downloadParquetDataFormatZip, downloadCompositeEngineZip, downloadAnalyticsBackendDatafusionZip
483+
dependsOn ':opensearch-sql-plugin:bundlePlugin'
484+
485+
systemProperty 'tests.security.manager', 'false'
486+
systemProperty 'project.root', project.projectDir.absolutePath
487+
488+
doFirst {
489+
systemProperty "https", "false"
490+
systemProperty "user", "admin"
491+
systemProperty "password", "admin"
492+
}
493+
494+
filter {
495+
includeTestsMatching 'org.opensearch.sql.security.AnalyticsEngineSecurityIT'
496+
}
497+
}
498+
499+
testClusters.analyticsEngineSecurityIT {
500+
testDistribution = 'archive'
501+
plugin(getJobSchedulerPlugin())
502+
plugin(getArrowBasePlugin())
503+
plugin(getArrowFlightRpcPlugin())
504+
plugin(getAnalyticsEnginePlugin())
505+
plugin(getAnalyticsBackendLucenePlugin())
506+
plugin(getAnalyticsBackendDatafusionPlugin())
507+
plugin(getParquetDataFormatPlugin())
508+
plugin(getCompositeEnginePlugin())
509+
plugin ":opensearch-sql-plugin"
510+
// Arrow Flight / streaming transport requirements
511+
jvmArgs '--add-opens=java.base/java.nio=ALL-UNNAMED'
512+
jvmArgs '--enable-native-access=ALL-UNNAMED'
513+
systemProperty 'io.netty.allocator.numDirectArenas', '1'
514+
systemProperty 'io.netty.noUnsafe', 'false'
515+
systemProperty 'io.netty.tryUnsafe', 'true'
516+
systemProperty 'io.netty.tryReflectionSetAccessible', 'true'
517+
systemProperty 'opensearch.experimental.feature.pluggable.dataformat.enabled', 'true'
518+
systemProperty 'opensearch.experimental.feature.transport.stream.enabled', 'true'
519+
// Native library path for DataFusion/parquet — pass via -PnativeLibPath=/path/to/release/
520+
if (project.findProperty('nativeLibPath')) {
521+
systemProperty 'java.library.path', project.findProperty('nativeLibPath')
522+
}
523+
}
524+
525+
configureSecurityPlugin(testClusters.analyticsEngineSecurityIT)
526+
402527
task integJdbcTest(type: RestIntegTestTask) {
403528
testClusters.findAll {c -> c.clusterName == "integJdbcTest"}.first().with {
404529
plugin ":opensearch-sql-plugin"
@@ -463,6 +588,11 @@ task integTestWithSecurity(type: RestIntegTestTask) {
463588
logger.quiet "${desc.className}.${desc.name}: ${result.resultType} ${(result.getEndTime() - result.getStartTime())/1000}s"
464589
}
465590

591+
// Exclude tests that require the analytics engine plugin stack (run separately via analyticsEngineSecurityIT)
592+
filter {
593+
excludeTestsMatching 'org.opensearch.sql.security.AnalyticsEngineSecurityIT'
594+
}
595+
466596
systemProperty 'tests.security.manager', 'false'
467597
systemProperty 'project.root', project.projectDir.absolutePath
468598

0 commit comments

Comments
 (0)