Skip to content

Commit

Permalink
Merge pull request #3 from wntmddus/Add-Convert-Index-To-Remote
Browse files Browse the repository at this point in the history
Fixing IT Test
  • Loading branch information
wntmddus authored Dec 17, 2024
2 parents 1eecabf + aa26147 commit cf02c08
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 @@ -101,6 +101,37 @@ abstract class IndexStateManagementRestTestCase : IndexManagementRestTestCase()
protected open fun enableValidationService() {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ConvertIndexToRemoteActionIT : IndexStateManagementRestTestCase() {
val policyID = "${testIndexName}_policy_basic"
val repository = "repository"

createOrUpdateRole()
// Step 1: Create an index and index some data
createIndex(indexName, null)
indexDoc(indexName, "1", """{"field": "value1"}""")
Expand Down

0 comments on commit cf02c08

Please sign in to comment.