Skip to content

Commit

Permalink
Revert "Permissive warnings handler"
Browse files Browse the repository at this point in the history
This reverts commit 7c82470.

Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Nov 27, 2024
1 parent 94d808b commit c663da7
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ package org.opensearch.indexmanagement.indexstatemanagement.resthandler

import org.junit.Before
import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.common.settings.Settings
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -94,9 +92,6 @@ class RestChangePolicyActionIT : IndexStateManagementRestTestCase() {
fun `test nonexistent ism config index`() {
if (indexExists(INDEX_MANAGEMENT_INDEX)) {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.rollup.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.common.settings.Settings
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementIndices
Expand Down Expand Up @@ -205,9 +203,6 @@ class RestStartRollupActionIT : RollupRestAPITestCase() {
fun `test start rollup when multiple shards configured for IM config index`() {
// setup ism-config index with multiple primary shards
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
val mapping = IndexManagementIndices.indexManagementMappings.trim().trimStart('{').trimEnd('}')
val settings =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.rollup.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.common.settings.Settings
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementIndices
Expand Down Expand Up @@ -261,9 +259,6 @@ class RestStopRollupActionIT : RollupRestAPITestCase() {
fun `test stop rollup when multiple shards configured for IM config index`() {
// setup ism-config index with multiple primary shards
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
val mapping = IndexManagementIndices.indexManagementMappings.trim().trimStart('{').trimEnd('}')
val settings =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -42,9 +40,6 @@ class RestDeleteSnapshotManagementIT : SnapshotManagementRestTestCase() {
fun `test deleting a snapshot management policy that doesn't exist and config index doesnt exist`() {
try {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
client().makeRequest("DELETE", "${IndexManagementPlugin.SM_POLICIES_URI}/nonexistent_policy")
fail("expected 404 ResponseException")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.common.xcontent.XContentType
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -145,9 +143,6 @@ class RestExplainSnapshotManagementIT : SnapshotManagementRestTestCase() {
fun `test explain sm policy when config index doesn't exist`() {
try {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
explainSMPolicy(randomAlphaOfLength(10))
fail("expected response exception")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ package org.opensearch.indexmanagement.snapshotmanagement.resthandler
import org.apache.hc.core5.http.HttpHeaders
import org.apache.hc.core5.http.message.BasicHeader
import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -53,9 +51,6 @@ class RestGetSnapshotManagementIT : SnapshotManagementRestTestCase() {
fun `test getting a snapshot management policy that doesn't exist and config index doesnt exist`() {
try {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
getSMPolicy(randomAlphaOfLength(20))
fail("expected response exception")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.common.xcontent.XContentType
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -134,9 +132,6 @@ class RestIndexSnapshotManagementIT : SnapshotManagementRestTestCase() {
@Suppress("UNCHECKED_CAST")
fun `test mappings after sm policy creation`() {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
createSMPolicy(randomSMPolicy())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -63,11 +61,8 @@ class RestStartSnapshotManagementIT : SnapshotManagementRestTestCase() {

fun `test starting a snapshot management policy with no config index fails`() {
try {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
val request = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
adminClient().performRequest(request)
client().makeRequest("POST", "${IndexManagementPlugin.SM_POLICIES_URI}/nonexistent_foo/_start")
fail("expected response exception")
} catch (e: ResponseException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.snapshotmanagement.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
Expand Down Expand Up @@ -64,9 +62,6 @@ class RestStopSnapshotManagementIT : SnapshotManagementRestTestCase() {
fun `test stopping a snapshot management policy with no config index fails`() {
try {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
client().makeRequest("POST", "${IndexManagementPlugin.SM_POLICIES_URI}/nonexistent_foo/_stop")
fail("expected response exception")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
package org.opensearch.indexmanagement.transform.resthandler

import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.TRANSFORM_BASE_URI
Expand Down Expand Up @@ -81,9 +79,6 @@ class RestDeleteTransformActionIT : TransformRestTestCase() {
try {
if (indexExists(INDEX_MANAGEMENT_INDEX)) {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
}
val res = client().makeRequest("DELETE", "$TRANSFORM_BASE_URI/foobarbaz")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ package org.opensearch.indexmanagement.transform.resthandler

import org.junit.Assert
import org.opensearch.client.Request
import org.opensearch.client.RequestOptions
import org.opensearch.client.ResponseException
import org.opensearch.client.WarningsHandler
import org.opensearch.core.rest.RestStatus
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.TRANSFORM_BASE_URI
Expand Down Expand Up @@ -164,9 +162,6 @@ class RestExplainTransformActionIT : TransformRestTestCase() {
@Throws(Exception::class)
fun `test explain transform when config doesnt exist`() {
val deleteISMIndexRequest = Request("DELETE", "/$INDEX_MANAGEMENT_INDEX")
val options = RequestOptions.DEFAULT.toBuilder()
options.setWarningsHandler(WarningsHandler.PERMISSIVE)
deleteISMIndexRequest.options = options.build()
adminClient().performRequest(deleteISMIndexRequest)
val responseExplicit = client().makeRequest("GET", "$TRANSFORM_BASE_URI/no_config_some_transform/_explain")
val expectedResponse = mapOf("no_config_some_transform" to "Failed to search transform metadata")
Expand Down

0 comments on commit c663da7

Please sign in to comment.