Skip to content

Commit 34cbac0

Browse files
committed
184: Refactored ISM rest test cases to consider forwarded client. Extended test cases and created reusable methods
Signed-off-by: Stevan Buzejic <buzejic.stevan@gmail.com>
1 parent 353b0fa commit 34cbac0

File tree

9 files changed

+691
-208
lines changed

9 files changed

+691
-208
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ src/test/resources/job-scheduler/
1414
src/test/resources/bwc/
1515
bin/
1616
spi/bin/
17-
src/test/resources/notifications*
18-
src/test/resources/security/opensearch-security*
17+
src/test/resources/notifications*

build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,12 @@ integTest {
406406
excludeTestsMatching "org.opensearch.indexmanagement.bwc.*IT"
407407
}
408408
}
409+
// Exclude security test
410+
if (System.getProperty("https") == null || System.getProperty("https") == "false") {
411+
filter {
412+
excludeTestsMatching "org.opensearch.*.Security*IT"
413+
}
414+
}
409415

410416
// TODO: Fix running notification test against remote cluster with security plugin installed
411417
if (System.getProperty("https") != null) {
@@ -446,11 +452,10 @@ task integTestRemote(type: RestIntegTestTask) {
446452
}
447453
}
448454

449-
if (System.getProperty("tests.rest.bwcsuite") == null) {
450-
filter {
451-
excludeTestsMatching "org.opensearch.indexmanagement.bwc.*IT"
452-
}
455+
if (System.getProperty("test.debug") != null) {
456+
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=8000'
453457
}
458+
454459
// Snapshot action integration tests rely on node level setting path.repo which we can't set remotely
455460
exclude 'org/opensearch/indexmanagement/indexstatemanagement/action/SnapshotActionIT.class'
456461
}

src/test/kotlin/org/opensearch/indexmanagement/AccessRoles.kt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,35 @@ import org.opensearch.indexmanagement.indexstatemanagement.transport.action.mana
1313
import org.opensearch.indexmanagement.rollup.action.explain.ExplainRollupAction
1414
import org.opensearch.indexmanagement.rollup.action.get.GetRollupAction
1515
import org.opensearch.indexmanagement.rollup.action.index.IndexRollupAction
16+
import org.opensearch.indexmanagement.rollup.action.mapping.UpdateRollupMappingAction
17+
import org.opensearch.indexmanagement.transform.action.explain.ExplainTransformAction
18+
import org.opensearch.indexmanagement.transform.action.get.GetTransformAction
19+
import org.opensearch.indexmanagement.transform.action.index.IndexTransformAction
20+
import org.opensearch.indexmanagement.transform.action.start.StartTransformAction
1621

22+
// ISM
1723
const val WRITE_POLICY = IndexPolicyAction.NAME
1824
const val GET_POLICIES = GetPoliciesAction.NAME
1925
const val GET_POLICY = GetPolicyAction.NAME
2026
const val EXPLAIN_INDEX = ExplainAction.NAME
2127
const val MANAGED_INDEX = ManagedIndexAction.NAME
28+
// Rollup
2229
const val ROLLUP_ALL = "cluster:admin/opendistro/rollup/*"
2330
const val INDEX_ROLLUP = IndexRollupAction.NAME
2431
const val GET_ROLLUP = GetRollupAction.NAME
2532
const val EXPLAIN_ROLLUP = ExplainRollupAction.NAME
26-
27-
// Index related
28-
const val GET_INDEX = "indices:admin/mappings/get"
33+
const val UPDATE_ROLLUP = UpdateRollupMappingAction.NAME
34+
// Transform
35+
const val TRANSFORM_ACTION = IndexTransformAction.NAME
36+
const val GET_TRANSFORM = GetTransformAction.NAME
37+
const val EXPLAIN_TRANSFORM = ExplainTransformAction.NAME
38+
const val START_TRANSFORM = StartTransformAction.NAME
39+
// In order to execute transform, user need to have health privilege
40+
const val HEALTH = "cluster:monitor/health"
41+
// Index
42+
const val GET_INDEX_MAPPING = "indices:admin/mappings/get"
43+
const val PUT_INDEX_MAPPING = "indices:admin/mapping/put"
2944
const val SEARCH_INDEX = "indices:data/read/search"
45+
const val CREATE_INDEX = "indices:admin/create"
46+
const val WRITE_INDEX = "indices:data/write/index"
47+
const val BULK_WRITE_INDEX = "indices:data/write/bulk*"

0 commit comments

Comments
 (0)