Skip to content

Commit aa64029

Browse files
committed
Fix tests
1 parent 4d5ff2a commit aa64029

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ public DatafeedConfig build() {
682682
if (!MlStrings.isValidId(id)) {
683683
throw ExceptionsHelper.badRequestException(Messages.getMessage(Messages.INVALID_ID, ID.getPreferredName(), id));
684684
}
685-
if (indices == null || indices.isEmpty() || indices.contains("")) {
685+
if (indices == null || indices.isEmpty() || indices.contains(null) || indices.contains("")) {
686686
throw invalidOptionValue(INDICES.getPreferredName(), indices);
687687
}
688688

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/GetDatafeedStatsActionResponseTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void testDatafeedStatsToXContent() throws IOException {
108108
assertThat(nodeAttributes, hasEntry("ml.max_open_jobs", "5"));
109109

110110
Map<String, Object> timingStatsMap = (Map<String, Object>) dfStatsMap.get("timing_stats");
111-
assertThat(timingStatsMap.size(), is(equalTo(2)));
111+
assertThat(timingStatsMap.size(), is(equalTo(3)));
112112
assertThat(timingStatsMap, hasEntry("job_id", "my-job-id"));
113113
assertThat(timingStatsMap, hasEntry("search_count", 5));
114114
assertThat(timingStatsMap, hasEntry("total_search_time_ms", 123.456));

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/DataExtractorFactoryTests.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,17 @@ public void testCreateDataExtractorFactoryGivenRollupAndRemoteIndex() {
256256
},
257257
e -> fail()
258258
);
259-
DataExtractorFactory.create(client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), listener);
259+
DataExtractorFactory.create(
260+
client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), timingStatsReporter, listener);
260261

261262
// Test with remote index, aggregation, and chunking
262263
datafeedConfig.setChunkingConfig(ChunkingConfig.newAuto());
263264
listener = ActionListener.wrap(
264265
dataExtractorFactory -> assertThat(dataExtractorFactory, instanceOf(ChunkedDataExtractorFactory.class)),
265266
e -> fail()
266267
);
267-
DataExtractorFactory.create(client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), listener);
268+
DataExtractorFactory.create(
269+
client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), timingStatsReporter, listener);
268270

269271
// Test with remote index, no aggregation, and no chunking
270272
datafeedConfig = DatafeedManagerTests.createDatafeedConfig("datafeed1", "foo");
@@ -276,15 +278,17 @@ public void testCreateDataExtractorFactoryGivenRollupAndRemoteIndex() {
276278
e -> fail()
277279
);
278280

279-
DataExtractorFactory.create(client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), listener);
281+
DataExtractorFactory.create(
282+
client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), timingStatsReporter, listener);
280283

281284
// Test with remote index, no aggregation, and chunking
282285
datafeedConfig.setChunkingConfig(ChunkingConfig.newAuto());
283286
listener = ActionListener.wrap(
284287
dataExtractorFactory -> assertThat(dataExtractorFactory, instanceOf(ChunkedDataExtractorFactory.class)),
285288
e -> fail()
286289
);
287-
DataExtractorFactory.create(client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), listener);
290+
DataExtractorFactory.create(
291+
client, datafeedConfig.build(), jobBuilder.build(new Date()), xContentRegistry(), timingStatsReporter, listener);
288292
}
289293

290294
public void testCreateDataExtractorFactoryGivenRollupAndValidAggregationAndAutoChunk() {

0 commit comments

Comments
 (0)