Skip to content

Commit df7af11

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 df7af11

File tree

12 files changed

+1361
-380
lines changed

12 files changed

+1361
-380
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: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,55 @@
55

66
package org.opensearch.indexmanagement
77

8+
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.addpolicy.AddPolicyAction
9+
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.deletepolicy.DeletePolicyAction
810
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.explain.ExplainAction
911
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.getpolicy.GetPoliciesAction
1012
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.getpolicy.GetPolicyAction
1113
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.indexpolicy.IndexPolicyAction
1214
import org.opensearch.indexmanagement.indexstatemanagement.transport.action.managedIndex.ManagedIndexAction
15+
import org.opensearch.indexmanagement.rollup.action.delete.DeleteRollupAction
1316
import org.opensearch.indexmanagement.rollup.action.explain.ExplainRollupAction
1417
import org.opensearch.indexmanagement.rollup.action.get.GetRollupAction
1518
import org.opensearch.indexmanagement.rollup.action.index.IndexRollupAction
19+
import org.opensearch.indexmanagement.rollup.action.mapping.UpdateRollupMappingAction
20+
import org.opensearch.indexmanagement.transform.action.delete.DeleteTransformsAction
21+
import org.opensearch.indexmanagement.transform.action.explain.ExplainTransformAction
22+
import org.opensearch.indexmanagement.transform.action.get.GetTransformAction
23+
import org.opensearch.indexmanagement.transform.action.get.GetTransformsAction
24+
import org.opensearch.indexmanagement.transform.action.index.IndexTransformAction
25+
import org.opensearch.indexmanagement.transform.action.start.StartTransformAction
26+
import org.opensearch.indexmanagement.transform.action.stop.StopTransformAction
1627

28+
// ISM
1729
const val WRITE_POLICY = IndexPolicyAction.NAME
30+
const val ADD_POLICY = AddPolicyAction.NAME
1831
const val GET_POLICIES = GetPoliciesAction.NAME
1932
const val GET_POLICY = GetPolicyAction.NAME
2033
const val EXPLAIN_INDEX = ExplainAction.NAME
2134
const val MANAGED_INDEX = ManagedIndexAction.NAME
35+
const val DELETE_POLICY = DeletePolicyAction.NAME
36+
// Rollup
2237
const val ROLLUP_ALL = "cluster:admin/opendistro/rollup/*"
2338
const val INDEX_ROLLUP = IndexRollupAction.NAME
2439
const val GET_ROLLUP = GetRollupAction.NAME
2540
const val EXPLAIN_ROLLUP = ExplainRollupAction.NAME
26-
27-
// Index related
28-
const val GET_INDEX = "indices:admin/mappings/get"
41+
const val UPDATE_ROLLUP = UpdateRollupMappingAction.NAME
42+
const val DELETE_ROLLUP = DeleteRollupAction.NAME
43+
// Transform
44+
const val TRANSFORM_ACTION = IndexTransformAction.NAME
45+
const val GET_TRANSFORM = GetTransformAction.NAME
46+
const val EXPLAIN_TRANSFORM = ExplainTransformAction.NAME
47+
const val START_TRANSFORM = StartTransformAction.NAME
48+
const val DELETE_TRANSFORM = DeleteTransformsAction.NAME
49+
const val GET_TRANSFORMS = GetTransformsAction.NAME
50+
const val STOP_TRANSFORM = StopTransformAction.NAME
51+
// In order to execute transform, user need to have health privilege
52+
const val HEALTH = "cluster:monitor/health"
53+
// Index
54+
const val GET_INDEX_MAPPING = "indices:admin/mappings/get"
55+
const val PUT_INDEX_MAPPING = "indices:admin/mapping/put"
2956
const val SEARCH_INDEX = "indices:data/read/search"
57+
const val CREATE_INDEX = "indices:admin/create"
58+
const val WRITE_INDEX = "indices:data/write/index"
59+
const val BULK_WRITE_INDEX = "indices:data/write/bulk*"

0 commit comments

Comments
 (0)