File tree 2 files changed +5
-6
lines changed
x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/history
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -338,9 +338,6 @@ tests:
338
338
- class : org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests
339
339
method : testSchedulerCloseWaitsForRunningMerge
340
340
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
344
341
- class : org.elasticsearch.index.shard.StoreRecoveryTests
345
342
method : testAddIndices
346
343
issue : https://github.com/elastic/elasticsearch/issues/124104
Original file line number Diff line number Diff line change 22
22
import java .util .Map ;
23
23
24
24
import static org .elasticsearch .xcontent .XContentFactory .jsonBuilder ;
25
+ import static org .hamcrest .Matchers .containsString ;
25
26
import static org .hamcrest .Matchers .equalTo ;
27
+ import static org .hamcrest .Matchers .matchesPattern ;
26
28
import static org .hamcrest .Matchers .startsWith ;
27
29
28
30
public class ILMHistoryItemTests extends ESTestCase {
@@ -135,15 +137,15 @@ public void testTruncateLongError() throws IOException {
135
137
try (XContentParser p = XContentFactory .xContent (XContentType .JSON ).createParser (XContentParserConfiguration .EMPTY , json )) {
136
138
Map <String , Object > item = p .map ();
137
139
assertThat (
138
- item .get ("error_details" ),
139
- equalTo (
140
+ ( String ) item .get ("error_details" ),
141
+ containsString (
140
142
"{\" type\" :\" illegal_argument_exception\" ,\" reason\" :\" "
141
143
// We subtract a number of characters here due to the truncation being based
142
144
// on the length of the whole string, not just the "reason" part.
143
145
+ longError .substring (0 , LifecycleExecutionState .MAXIMUM_STEP_INFO_STRING_LENGTH - 47 )
144
- + "... (5126 chars truncated)\" }"
145
146
)
146
147
);
148
+ assertThat ((String ) item .get ("error_details" ), matchesPattern (".*\\ .\\ .\\ . \\ (\\ d+ chars truncated\\ ).*" ));
147
149
}
148
150
}
149
151
}
You can’t perform that action at this time.
0 commit comments