Skip to content

Commit 4178547

Browse files
committed
Added options to simple() method
1 parent bdcf2c5 commit 4178547

29 files changed

+44
-47
lines changed

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.elasticsearch.compute.operator.SourceOperator;
3939
import org.elasticsearch.compute.test.BlockTestUtils;
4040
import org.elasticsearch.compute.test.CannedSourceOperator;
41-
import org.elasticsearch.compute.test.OperatorTestCase;
4241
import org.elasticsearch.compute.test.TestBlockFactory;
4342
import org.elasticsearch.core.Nullable;
4443
import org.elasticsearch.core.Releasables;
@@ -47,7 +46,6 @@
4746
import org.hamcrest.Matcher;
4847

4948
import java.util.ArrayList;
50-
import java.util.Arrays;
5149
import java.util.List;
5250
import java.util.SortedSet;
5351
import java.util.TreeSet;
@@ -130,23 +128,6 @@ private Operator.OperatorFactory simpleWithMode(
130128
}
131129
}
132130

133-
/**
134-
* Checks whether the class is being run by {@link org.elasticsearch.compute.test.OperatorTestCase#testSimpleCircuitBreaking} or not.
135-
* <p>
136-
* If it is, then we can't randomize blocks, as it expects a deterministic memory usage.
137-
* </p>
138-
* <p>
139-
* Explicitly linking {@link org.elasticsearch.compute.test.OperatorTestCase#testSimpleCircuitBreaking} as
140-
* this method looks for it based on its name, so any modification there should be updated here!
141-
* </p>
142-
*/
143-
private boolean shouldRandomizeBlocks() {
144-
return Arrays.stream(Thread.currentThread().getStackTrace())
145-
.noneMatch(
146-
e -> e.getClassName().equals(OperatorTestCase.class.getName()) && e.getMethodName().equals("testSimpleCircuitBreaking")
147-
);
148-
}
149-
150131
@Override
151132
protected final Matcher<String> expectedDescriptionOfSimple() {
152133
return equalTo("HashAggregationOperator[mode = <not-needed>, aggs = " + expectedDescriptionOfAggregator() + "]");

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneCountOperatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void closeIndex() throws IOException {
5151
}
5252

5353
@Override
54-
protected LuceneCountOperator.Factory simple() {
54+
protected LuceneCountOperator.Factory simple(SimpleOptions options) {
5555
return simple(randomFrom(DataPartitioning.values()), between(1, 10_000), 100);
5656
}
5757

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMaxOperatorTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void closeIndex() throws IOException {
7373
}
7474

7575
@Override
76-
protected LuceneMaxFactory simple() {
76+
protected LuceneMaxFactory simple(SimpleOptions options) {
7777
return simple(getNumberTypeTest(), randomFrom(DataPartitioning.values()), between(1, 10_000), 100);
7878
}
7979

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMinOperatorTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void closeIndex() throws IOException {
7373
}
7474

7575
@Override
76-
protected LuceneMinFactory simple() {
76+
protected LuceneMinFactory simple(SimpleOptions options) {
7777
return simple(getNumberTypeTest(), randomFrom(DataPartitioning.values()), between(1, 10_000), 100);
7878
}
7979

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneSourceOperatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void closeIndex() throws IOException {
7272
}
7373

7474
@Override
75-
protected LuceneSourceOperator.Factory simple() {
75+
protected LuceneSourceOperator.Factory simple(SimpleOptions options) {
7676
return simple(randomFrom(DataPartitioning.values()), between(1, 10_000), 100, scoring);
7777
}
7878

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorScoringTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private void closeIndex() throws IOException {
5858
}
5959

6060
@Override
61-
protected LuceneTopNSourceOperator.Factory simple() {
61+
protected LuceneTopNSourceOperator.Factory simple(SimpleOptions options) {
6262
return simple(DataPartitioning.SHARD, 10_000, 100);
6363
}
6464

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private void closeIndex() throws IOException {
6363
}
6464

6565
@Override
66-
protected LuceneTopNSourceOperator.Factory simple() {
66+
protected LuceneTopNSourceOperator.Factory simple(SimpleOptions options) {
6767
return simple(DataPartitioning.SHARD, 10_000, 100);
6868
}
6969

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/TimeSeriesSourceOperatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public void testMatchNone() throws Exception {
328328
}
329329

330330
@Override
331-
protected Operator.OperatorFactory simple() {
331+
protected Operator.OperatorFactory simple(SimpleOptions options) {
332332
return createTimeSeriesSourceOperator(directory, r -> this.reader = r, randomBoolean(), List.of(), 1, 1, false, writer -> {
333333
long timestamp = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.parseMillis("2024-01-01T00:00:00Z");
334334
writeTS(writer, timestamp, new Object[] { "hostname", "host-01" }, new Object[] { "voltage", 2 });

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValueSourceReaderTypeConversionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private IndexReader reader(String indexKey) {
216216
}
217217

218218
@Override
219-
protected Operator.OperatorFactory simple() {
219+
protected Operator.OperatorFactory simple(SimpleOptions options) {
220220
return factory(initShardContexts(), mapperService("index1").fieldType("long"), ElementType.LONG);
221221
}
222222

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void closeIndex() throws IOException {
127127
}
128128

129129
@Override
130-
protected Operator.OperatorFactory simple() {
130+
protected Operator.OperatorFactory simple(SimpleOptions options) {
131131
if (reader == null) {
132132
// Init a reader if one hasn't been built, so things don't blow up
133133
try {

0 commit comments

Comments
 (0)