8
8
9
9
import org .elasticsearch .action .admin .indices .mapping .get .GetMappingsResponse ;
10
10
import org .elasticsearch .action .search .SearchRequestBuilder ;
11
+ import org .elasticsearch .common .settings .Settings ;
11
12
import org .elasticsearch .common .unit .ByteSizeValue ;
12
13
import org .elasticsearch .protocol .xpack .watcher .PutWatchResponse ;
13
14
import org .elasticsearch .search .SearchHit ;
53
54
54
55
public class HistoryIntegrationTests extends AbstractWatcherIntegrationTestCase {
55
56
57
+ @ Override
58
+ protected Settings nodeSettings (int nodeOrdinal , Settings otherSettings ) {
59
+
60
+ return Settings .builder ()
61
+ .put (super .nodeSettings (nodeOrdinal , otherSettings ))
62
+ .put ("xpack.watcher.max.history.record.size" , "100kb" ) // used for testThatHistoryIsTruncated()
63
+ .build ();
64
+ }
65
+
56
66
// issue: https://github.com/elastic/x-plugins/issues/2338
57
67
public void testThatHistoryIsWrittenWithChainedInput () throws Exception {
58
68
XContentBuilder xContentBuilder = jsonBuilder ().startObject ()
@@ -232,13 +242,13 @@ public void testThatHistoryContainsStatus() throws Exception {
232
242
public void testThatHistoryIsTruncated () throws Exception {
233
243
{
234
244
/*
235
- * The input for this watch is 1 MB , smaller than the 10 MB default of HistoryStore's MAX_HISTORY_SIZE_SETTING. So we do not
236
- * expect its history record to be truncated.
245
+ * The input for this watch is 20 KB , smaller than the configured 100 KB of HistoryStore's MAX_HISTORY_SIZE_SETTING. So we do
246
+ * not expect its history record to be truncated.
237
247
*/
238
248
new PutWatchRequestBuilder (client ()).setId ("test_watch_small" )
239
249
.setSource (
240
250
watchBuilder ().trigger (schedule (interval (5 , IntervalSchedule .Interval .Unit .HOURS )))
241
- .input (simpleInput ("foo" , randomAlphaOfLength ((int ) ByteSizeValue .ofMb ( 1 ).getBytes ())))
251
+ .input (simpleInput ("foo" , randomAlphaOfLength ((int ) ByteSizeValue .ofKb ( 20 ).getBytes ())))
242
252
.addAction ("_logger" , loggingAction ("#### randomLogging" ))
243
253
)
244
254
.get ();
@@ -261,13 +271,13 @@ public void testThatHistoryIsTruncated() throws Exception {
261
271
}
262
272
{
263
273
/*
264
- * The input for this watch is 20 MB , much bigger than the 10 MB default of HistoryStore's MAX_HISTORY_SIZE_SETTING. So we
274
+ * The input for this watch is 500 KB , much bigger than the configured 100 KB of HistoryStore's MAX_HISTORY_SIZE_SETTING. So we
265
275
* expect to see its history record truncated before being stored.
266
276
*/
267
277
new PutWatchRequestBuilder (client ()).setId ("test_watch_large" )
268
278
.setSource (
269
279
watchBuilder ().trigger (schedule (interval (5 , IntervalSchedule .Interval .Unit .HOURS )))
270
- .input (simpleInput ("foo" , randomAlphaOfLength ((int ) ByteSizeValue .ofMb ( 20 ).getBytes ())))
280
+ .input (simpleInput ("foo" , randomAlphaOfLength ((int ) ByteSizeValue .ofKb ( 500 ).getBytes ())))
271
281
.addAction ("_logger" , loggingAction ("#### randomLogging" ))
272
282
)
273
283
.get ();
0 commit comments