Skip to content

Commit

Permalink
Fixing IT
Browse files Browse the repository at this point in the history
Signed-off-by: Seung Yeon Joo <[email protected]>
  • Loading branch information
Seung Yeon Joo committed Dec 17, 2024
1 parent 5c7dd7c commit 1af9daa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 33 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ integTest {
excludeTestsMatching "org.opensearch.indexmanagement.indexstatemanagement.action.NotificationActionIT"
}
exclude 'org/opensearch/indexmanagement/indexstatemanagement/MetadataRegressionIT.class'
exclude 'org/opensearch/indexmanagement/indexstatemanagement/ConvertIndexToRemoteIT.class'
}

// TODO: raise issue in Core, this is because of the test framework
Expand Down Expand Up @@ -634,6 +635,7 @@ task integTestRemote(type: RestIntegTestTask) {

// Snapshot action integration tests rely on node level setting path.repo which we can't set remotely
exclude 'org/opensearch/indexmanagement/indexstatemanagement/action/SnapshotActionIT.class'
exclude 'org/opensearch/indexmanagement/indexstatemanagement/action/ConvertIndexToRemoteIT.class'
}

// === Set up BWC tests ===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,38 +101,6 @@ 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,
policyId: String = OpenSearchTestCase.randomAlphaOfLength(10),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ 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 1af9daa

Please sign in to comment.