From d56496c489bfebf13a9eaa075bbb8240b6c931fb Mon Sep 17 00:00:00 2001 From: Nicholas Walter Knize Date: Wed, 7 Jun 2023 16:23:52 -0500 Subject: [PATCH] integration test fixes Signed-off-by: Nicholas Walter Knize --- .../opensearch/BaseOpenSearchException.java | 21 ++++++++++++++----- .../http/DetailedErrorsEnabledIT.java | 2 +- .../org/opensearch/OpenSearchException.java | 9 -------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java b/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java index 533c98c5d3add..199e2ad7c7f1f 100644 --- a/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java +++ b/libs/core/src/main/java/org/opensearch/BaseOpenSearchException.java @@ -34,7 +34,6 @@ import org.opensearch.common.CheckedFunction; import org.opensearch.common.Nullable; import org.opensearch.common.collect.Tuple; -import org.opensearch.core.common.ParsingException; import org.opensearch.core.common.Strings; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; @@ -42,7 +41,6 @@ import org.opensearch.core.common.logging.LoggerMessageFormat; import org.opensearch.core.index.Index; import org.opensearch.core.index.shard.ShardId; -import org.opensearch.core.index.snapshots.IndexShardSnapshotFailedException; import org.opensearch.core.rest.RestStatus; import org.opensearch.core.xcontent.ToXContent; import org.opensearch.core.xcontent.ToXContentFragment; @@ -89,14 +87,27 @@ public class BaseOpenSearchException extends RuntimeException implements Writeab static { registerExceptionHandle( new BaseOpenSearchExceptionHandle( - IndexShardSnapshotFailedException.class, - IndexShardSnapshotFailedException::new, + org.opensearch.core.index.snapshots.IndexShardSnapshotFailedException.class, + org.opensearch.core.index.snapshots.IndexShardSnapshotFailedException::new, 0, UNKNOWN_VERSION_ADDED ) ); registerExceptionHandle( - new BaseOpenSearchExceptionHandle(ParsingException.class, ParsingException::new, 40, UNKNOWN_VERSION_ADDED) + new BaseOpenSearchExceptionHandle( + org.opensearch.core.common.ParsingException.class, + org.opensearch.core.common.ParsingException::new, + 40, + UNKNOWN_VERSION_ADDED + ) + ); + registerExceptionHandle( + new BaseOpenSearchExceptionHandle( + org.opensearch.core.common.io.stream.NotSerializableExceptionWrapper.class, + org.opensearch.core.common.io.stream.NotSerializableExceptionWrapper::new, + 62, + UNKNOWN_VERSION_ADDED + ) ); } diff --git a/qa/smoke-test-http/src/test/java/org/opensearch/http/DetailedErrorsEnabledIT.java b/qa/smoke-test-http/src/test/java/org/opensearch/http/DetailedErrorsEnabledIT.java index e2ccf86d31dbf..76f801c75d866 100644 --- a/qa/smoke-test-http/src/test/java/org/opensearch/http/DetailedErrorsEnabledIT.java +++ b/qa/smoke-test-http/src/test/java/org/opensearch/http/DetailedErrorsEnabledIT.java @@ -58,7 +58,7 @@ public void testThatErrorTraceWorksByDefault() throws IOException, ParseExceptio Response response = e.getResponse(); assertThat(response.getHeader("Content-Type"), containsString("application/json")); assertThat(EntityUtils.toString(response.getEntity()), - containsString("\"stack_trace\":\"[Validation Failed: 1: index / indices is missing;]; " + + containsString("\"stack_trace\":\"OpenSearchException[Validation Failed: 1: index / indices is missing;]; " + "nested: ActionRequestValidationException[Validation Failed: 1:")); } diff --git a/server/src/main/java/org/opensearch/OpenSearchException.java b/server/src/main/java/org/opensearch/OpenSearchException.java index 7280f6824d913..7cb56e7d67ac5 100644 --- a/server/src/main/java/org/opensearch/OpenSearchException.java +++ b/server/src/main/java/org/opensearch/OpenSearchException.java @@ -40,7 +40,6 @@ import org.opensearch.cluster.service.ClusterManagerThrottlingException; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; -import org.opensearch.core.common.io.stream.NotSerializableExceptionWrapper; import org.opensearch.core.index.snapshots.IndexShardSnapshotException; import org.opensearch.search.aggregations.MultiBucketConsumerService; import org.opensearch.search.pipeline.SearchPipelineProcessingException; @@ -487,14 +486,6 @@ public class OpenSearchException extends BaseOpenSearchException { // 59 used to be OpenSearchRejectedExecutionException // 60 used to be for EarlyTerminationException // 61 used to be for RoutingValidationException - registerExceptionHandle( - new BaseOpenSearchExceptionHandle( - NotSerializableExceptionWrapper.class, - NotSerializableExceptionWrapper::new, - 62, - UNKNOWN_VERSION_ADDED - ) - ); registerExceptionHandle( new BaseOpenSearchExceptionHandle( org.opensearch.indices.AliasFilterParsingException.class,