Skip to content

Commit

Permalink
Removes allow_list test
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Downs <[email protected]>
  • Loading branch information
downsrob committed Feb 17, 2022
1 parent 8125bb8 commit feb15a1
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.opensearch.indexmanagement.indexstatemanagement.runner

import org.opensearch.indexmanagement.indexstatemanagement.ISMActionsParser
import org.opensearch.indexmanagement.indexstatemanagement.IndexStateManagementRestTestCase
import org.opensearch.indexmanagement.indexstatemanagement.action.OpenAction
import org.opensearch.indexmanagement.indexstatemanagement.action.ReadOnlyAction
Expand Down Expand Up @@ -168,20 +167,8 @@ class ManagedIndexRunnerIT : IndexStateManagementRestTestCase() {
updateManagedIndexConfigStartTime(managedIndexConfig)
waitFor { assertEquals(AttemptTransitionStep.getSuccessMessage(indexName, firstState.name), getExplainManagedIndexMetaData(indexName).info?.get("message")) }

// We moved from the allow_list to the blocked_actions_list setting, but need to support both. Test both using randomization
if (randomBoolean()) {
// block the read_only action
val blockedActions = "[\"${ReadOnlyAction.name}\"]"
updateClusterSetting(ManagedIndexSettings.BLOCKED_ACTIONS_LIST.key, blockedActions, escapeValue = false)
} else {
// remove read_only from the allowlist
val allowedActions = ISMActionsParser.instance.parsers.map { it.getActionType() }.toList()
.filter { actionType -> actionType != ReadOnlyAction.name }
.joinToString(prefix = "[", postfix = "]") { string -> "\"$string\"" }
updateClusterSetting(ManagedIndexSettings.ALLOW_LIST.key, allowedActions, escapeValue = false)
// Note that the setting is expected to throw a deprecation warning so we don't fail the test
assertSettingDeprecationsAndWarnings(arrayOf(ManagedIndexSettings.ALLOW_LIST.key))
}
// block the read_only action
updateClusterSetting(ManagedIndexSettings.BLOCKED_ACTIONS_LIST.key, "[\"${ReadOnlyAction.name}\"]", escapeValue = false)

// speed up to fifth execution that should try to set index to read only and fail because the action is not allowed
updateManagedIndexConfigStartTime(managedIndexConfig)
Expand Down

0 comments on commit feb15a1

Please sign in to comment.