File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/history Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -338,9 +338,6 @@ tests:
338338- class : org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests
339339 method : testSchedulerCloseWaitsForRunningMerge
340340 issue : https://github.com/elastic/elasticsearch/issues/125236
341- - class : org.elasticsearch.xpack.ilm.history.ILMHistoryItemTests
342- method : testTruncateLongError
343- issue : https://github.com/elastic/elasticsearch/issues/125216
344341- class : org.elasticsearch.index.shard.StoreRecoveryTests
345342 method : testAddIndices
346343 issue : https://github.com/elastic/elasticsearch/issues/124104
Original file line number Diff line number Diff line change 2222import java .util .Map ;
2323
2424import static org .elasticsearch .xcontent .XContentFactory .jsonBuilder ;
25+ import static org .hamcrest .Matchers .containsString ;
2526import static org .hamcrest .Matchers .equalTo ;
27+ import static org .hamcrest .Matchers .matchesPattern ;
2628import static org .hamcrest .Matchers .startsWith ;
2729
2830public class ILMHistoryItemTests extends ESTestCase {
@@ -135,15 +137,15 @@ public void testTruncateLongError() throws IOException {
135137 try (XContentParser p = XContentFactory .xContent (XContentType .JSON ).createParser (XContentParserConfiguration .EMPTY , json )) {
136138 Map <String , Object > item = p .map ();
137139 assertThat (
138- item .get ("error_details" ),
139- equalTo (
140+ ( String ) item .get ("error_details" ),
141+ containsString (
140142 "{\" type\" :\" illegal_argument_exception\" ,\" reason\" :\" "
141143 // We subtract a number of characters here due to the truncation being based
142144 // on the length of the whole string, not just the "reason" part.
143145 + longError .substring (0 , LifecycleExecutionState .MAXIMUM_STEP_INFO_STRING_LENGTH - 47 )
144- + "... (5126 chars truncated)\" }"
145146 )
146147 );
148+ assertThat ((String ) item .get ("error_details" ), matchesPattern (".*\\ .\\ .\\ . \\ (\\ d+ chars truncated\\ ).*" ));
147149 }
148150 }
149151 }
You can’t perform that action at this time.
0 commit comments