From 28cab49926255e7f439ce92f18b984f5b6c49279 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 23 Feb 2022 12:25:23 +0100 Subject: [PATCH] random tests --- .../xpack/ilm/ExecuteStepsUpdateTaskTests.java | 4 ++-- .../xpack/ilm/IndexLifecycleTransitionTests.java | 2 +- .../xpack/ilm/MoveToErrorStepUpdateTaskTests.java | 11 +---------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTaskTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTaskTests.java index 2f8a35645d65b..97a57729735a7 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTaskTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTaskTests.java @@ -303,7 +303,7 @@ public void testClusterActionStepThrowsException() throws Exception { assertThat(lifecycleState.phaseTime(), nullValue()); assertThat(lifecycleState.actionTime(), nullValue()); assertThat(lifecycleState.stepInfo(), containsString(""" - {"type":"runtime_exception","reason":"error","stack_trace":\"""")); + {"type":"runtime_exception","reason":"error\"""")); } public void testClusterWaitStepThrowsException() throws Exception { @@ -322,7 +322,7 @@ public void testClusterWaitStepThrowsException() throws Exception { assertThat(lifecycleState.phaseTime(), nullValue()); assertThat(lifecycleState.actionTime(), nullValue()); assertThat(lifecycleState.stepInfo(), containsString(""" - {"type":"runtime_exception","reason":"error","stack_trace":\"""")); + {"type":"runtime_exception","reason":"error\"""")); } private void setStateToKey(StepKey stepKey) throws IOException { diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java index 323c6614d8c94..b58f3659a01a6 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java @@ -346,7 +346,7 @@ public void testMoveClusterStateToErrorStep() throws IOException { (idxMeta, stepKey) -> new MockStep(stepKey, nextStepKey) ); assertClusterStateOnErrorStep(clusterState, index, currentStep, newClusterState, now, """ - {"type":"illegal_argument_exception","reason":"non elasticsearch-exception","stack_trace":\""""); + {"type":"illegal_argument_exception","reason":"non elasticsearch-exception\""""); } public void testAddStepInfoToClusterState() throws IOException { diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/MoveToErrorStepUpdateTaskTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/MoveToErrorStepUpdateTaskTests.java index 76b383cc221f6..af255d6962b63 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/MoveToErrorStepUpdateTaskTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/MoveToErrorStepUpdateTaskTests.java @@ -13,13 +13,9 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.LifecycleExecutionState; import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xcontent.ToXContent; -import org.elasticsearch.xcontent.XContentBuilder; -import org.elasticsearch.xcontent.json.JsonXContent; import org.elasticsearch.xpack.core.ilm.ErrorStep; import org.elasticsearch.xpack.core.ilm.IndexLifecycleMetadata; import org.elasticsearch.xpack.core.ilm.LifecyclePolicy; @@ -98,13 +94,8 @@ public void testExecuteSuccessfullyMoved() throws IOException { assertThat(lifecycleState.actionTime(), nullValue()); assertThat(lifecycleState.stepTime(), equalTo(now)); - XContentBuilder causeXContentBuilder = JsonXContent.contentBuilder(); - causeXContentBuilder.startObject(); - ElasticsearchException.generateThrowableXContent(causeXContentBuilder, ToXContent.EMPTY_PARAMS, cause); - causeXContentBuilder.endObject(); - String expectedCauseValue = BytesReference.bytes(causeXContentBuilder).utf8ToString(); assertThat(lifecycleState.stepInfo(), containsString(""" - {"type":"exception","reason":"THIS IS AN EXPECTED CAUSE","stack_trace":\"""")); + {"type":"exception","reason":"THIS IS AN EXPECTED CAUSE\"""")); } public void testExecuteNoopDifferentStep() throws IOException {