|
33 | 33 | import static org.elasticsearch.index.mapper.DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER; |
34 | 34 | import static org.hamcrest.Matchers.closeTo; |
35 | 35 | import static org.hamcrest.Matchers.containsString; |
| 36 | +import static org.hamcrest.Matchers.either; |
36 | 37 | import static org.hamcrest.Matchers.empty; |
37 | 38 | import static org.hamcrest.Matchers.equalTo; |
38 | 39 | import static org.hamcrest.Matchers.hasSize; |
@@ -553,7 +554,9 @@ public void testProfile() { |
553 | 554 | if (p.operators().stream().anyMatch(s -> s.status() instanceof TimeSeriesSourceOperator.Status)) { |
554 | 555 | assertThat(p.operators(), hasSize(2)); |
555 | 556 | TimeSeriesSourceOperator.Status status = (TimeSeriesSourceOperator.Status) p.operators().get(0).status(); |
556 | | - assertThat(status.processedShards(), hasSize(1)); |
| 557 | + // If the target shard is empty or does not match the query, processedShards will be empty. |
| 558 | + // TODO: Update ComputeService to avoid creating pipelines for non-matching or empty shards. |
| 559 | + assertThat(status.processedShards(), either(hasSize(1)).or(empty())); |
557 | 560 | assertThat(p.operators().get(1).operator(), equalTo("ExchangeSinkOperator")); |
558 | 561 | } else if (p.operators().stream().anyMatch(s -> s.status() instanceof TimeSeriesAggregationOperator.Status)) { |
559 | 562 | assertThat(p.operators(), hasSize(3)); |
@@ -587,7 +590,7 @@ public void testProfile() { |
587 | 590 | assertThat(ops.get(0).operator(), containsString("LuceneSourceOperator")); |
588 | 591 | assertThat(ops.get(0).status(), Matchers.instanceOf(LuceneSourceOperator.Status.class)); |
589 | 592 | LuceneSourceOperator.Status status = (LuceneSourceOperator.Status) ops.get(0).status(); |
590 | | - assertThat(status.processedShards(), hasSize(3)); |
| 593 | + assertThat(status.processedShards().size(), Matchers.lessThanOrEqualTo(3)); |
591 | 594 | assertThat(ops.get(1).operator(), containsString("EvalOperator")); |
592 | 595 | assertThat(ops.get(2).operator(), containsString("ValuesSourceReaderOperator")); |
593 | 596 | assertThat(ops.get(3).operator(), containsString("TimeSeriesAggregationOperator")); |
|
0 commit comments