Skip to content

Commit

Permalink
Fixing IT
Browse files Browse the repository at this point in the history
Signed-off-by: Seung Yeon Joo <seung.yeon.joo@oracle.com>
  • Loading branch information
Seung Yeon Joo committed Dec 17, 2024
1 parent 1eecabf commit 4063eca
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,37 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase()
updateValidationServiceSetting(true)
}

protected fun createOrUpdateRole() {
val roleBody = """
{
"cluster_permissions": ["cluster:admin/snapshot/restore", "cluster:admin/snapshot/create"],
"index_permissions": [
{
"index_patterns": ["*"],
"allowed_actions": ["indices:*"]
}
]
}
""".trimIndent()

client().makeRequest(
method = "PUT",
endpoint = "/_plugins/_security/api/roles/snapshot_restore_role",
entity = StringEntity(roleBody, ContentType.APPLICATION_JSON),
)

// Map your test user to snapshot_restore_role
val roleMappingBody = """
{
"users": ["testUser"]
}
""".trimIndent()
client().makeRequest(
method = "PUT",
endpoint = "/_plugins/_security/api/rolesmapping/snapshot_restore_role",
entity = StringEntity(roleMappingBody, ContentType.APPLICATION_JSON),
)
}
protected fun createPolicy(
policy: Policy,
policyId: String = OpenSearchTestCase.randomAlphaOfLength(10),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ConvertIndexToRemoteActionIT : IndexStateManagementRestTestCase() {
private val testIndexName = javaClass.simpleName.lowercase(Locale.ROOT)

fun `test basic conversion to remote index`() {
createOrUpdateRole()
val indexName = "${testIndexName}_index_basic"
val policyID = "${testIndexName}_policy_basic"
val repository = "repository"
Expand Down

0 comments on commit 4063eca

Please sign in to comment.