Skip to content

Commit 31d561a

Browse files
author
Hendrik Muhs
authored
[7.x] unmute continuous transform testing on sorted indexes (#73411)
unmute continuous transform testing on sorted indexes. These extra test randomness has been disabled due to triggered lucene assertions. The upstream issue seems to have been fixed. backport #72692, #72742
1 parent f926d42 commit 31d561a

File tree

1 file changed

+24
-8
lines changed
  • x-pack/plugin/transform/qa/multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/continuous

1 file changed

+24
-8
lines changed

x-pack/plugin/transform/qa/multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/continuous/TransformContinuousIT.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
4141
import org.elasticsearch.common.xcontent.XContentBuilder;
4242
import org.elasticsearch.common.xcontent.XContentType;
43+
4344
import org.elasticsearch.search.SearchModule;
4445
import org.elasticsearch.test.rest.ESRestTestCase;
4546
import org.junit.After;
@@ -58,10 +59,12 @@
5859
import java.util.HashSet;
5960
import java.util.List;
6061
import java.util.Locale;
62+
6163
import java.util.Set;
6264
import java.util.concurrent.TimeUnit;
6365

6466
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
67+
6568
import static org.hamcrest.Matchers.greaterThan;
6669
import static org.hamcrest.core.Is.is;
6770

@@ -152,7 +155,7 @@ public void removePipelines() throws IOException {
152155
deletePipeline(ContinuousTestCase.INGEST_PIPELINE);
153156
}
154157

155-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/66410")
158+
156159
public void testContinousEvents() throws Exception {
157160
String sourceIndexName = ContinuousTestCase.CONTINUOUS_EVENTS_SOURCE_INDEX;
158161
DecimalFormat numberFormat = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ROOT));
@@ -301,6 +304,8 @@ public void testContinousEvents() throws Exception {
301304
* index sorting, triggers query optimizations.
302305
*/
303306
private void putIndex(String indexName, String dateType, boolean isDataStream) throws IOException {
307+
List<String> sortedFields = Collections.emptyList();
308+
304309
// create mapping and settings
305310
try (XContentBuilder builder = jsonBuilder()) {
306311
builder.startObject();
@@ -310,9 +315,8 @@ private void putIndex(String indexName, String dateType, boolean isDataStream) t
310315
if (randomBoolean()) {
311316
builder.field("codec", "best_compression");
312317
}
313-
// TODO: crashes with assertions enabled in lucene
314-
if (false && randomBoolean()) {
315-
List<String> sortedFields = new ArrayList<>(
318+
if (randomBoolean()) {
319+
sortedFields = new ArrayList<>(
316320
// note: no index sort for geo_point
317321
randomUnique(() -> randomFrom("event", "metric", "run", "timestamp"), randomIntBetween(1, 3))
318322
);
@@ -336,11 +340,16 @@ private void putIndex(String indexName, String dateType, boolean isDataStream) t
336340
}
337341
builder.endObject();
338342

343+
// gh#72741 : index sort does not support unsigned_long
344+
final String metricType = sortedFields.contains("metric")
345+
? randomFrom("integer", "long")
346+
: randomFrom("integer", "long", "unsigned_long");
347+
339348
builder.startObject("event")
340349
.field("type", "keyword")
341350
.endObject()
342351
.startObject("metric")
343-
.field("type", randomFrom("integer", "long", "unsigned_long"))
352+
.field("type", metricType)
344353
.endObject()
345354
.startObject("location")
346355
.field("type", "geo_point")
@@ -397,8 +406,8 @@ private void putIndex(String indexName, String dateType, boolean isDataStream) t
397406
.endObject()
398407
.endObject();
399408

400-
// random overlay of existing field
401-
if (randomBoolean()) {
409+
// random overlay of existing field, only if its not part of sorted fields
410+
if (sortedFields.contains("metric") == false && randomBoolean()) {
402411
if (randomBoolean()) {
403412
builder.startObject("metric").field("type", "long").endObject();
404413
} else {
@@ -475,6 +484,7 @@ private void createOrUpdatePipeline(String field, int run) throws IOException {
475484
putPipeline(new PutPipelineRequest(ContinuousTestCase.INGEST_PIPELINE, BytesReference.bytes(pipeline), XContentType.JSON))
476485
.isAcknowledged()
477486
);
487+
478488
}
479489

480490
private GetTransformStatsResponse getTransformStats(String id) throws IOException {
@@ -538,18 +548,21 @@ private void refreshIndex(String index) throws IOException {
538548
private AcknowledgedResponse putTransform(TransformConfig config) throws IOException {
539549
try (RestHighLevelClient restClient = new TestRestHighLevelClient()) {
540550
return restClient.transform().putTransform(new PutTransformRequest(config), RequestOptions.DEFAULT);
551+
541552
}
542553
}
543554

544555
private org.elasticsearch.action.support.master.AcknowledgedResponse putPipeline(PutPipelineRequest pipeline) throws IOException {
545556
try (RestHighLevelClient restClient = new TestRestHighLevelClient()) {
546557
return restClient.ingest().putPipeline(pipeline, RequestOptions.DEFAULT);
558+
547559
}
548560
}
549561

550562
private org.elasticsearch.action.support.master.AcknowledgedResponse deletePipeline(String id) throws IOException {
551563
try (RestHighLevelClient restClient = new TestRestHighLevelClient()) {
552564
return restClient.ingest().deletePipeline(new DeletePipelineRequest(id), RequestOptions.DEFAULT);
565+
553566
}
554567
}
555568

@@ -562,6 +575,7 @@ private GetTransformResponse getTransforms() throws IOException {
562575
private StartTransformResponse startTransform(String id) throws IOException {
563576
try (RestHighLevelClient restClient = new TestRestHighLevelClient()) {
564577
return restClient.transform().startTransform(new StartTransformRequest(id), RequestOptions.DEFAULT);
578+
565579
}
566580
}
567581

@@ -570,6 +584,7 @@ private StopTransformResponse stopTransform(String id, boolean waitForCompletion
570584
try (RestHighLevelClient restClient = new TestRestHighLevelClient()) {
571585
return restClient.transform()
572586
.stopTransform(new StopTransformRequest(id, waitForCompletion, timeout, waitForCheckpoint), RequestOptions.DEFAULT);
587+
573588
}
574589
}
575590

@@ -578,6 +593,7 @@ private AcknowledgedResponse deleteTransform(String id, boolean force) throws IO
578593
DeleteTransformRequest deleteRequest = new DeleteTransformRequest(id);
579594
deleteRequest.setForce(force);
580595
return restClient.transform().deleteTransform(deleteRequest, RequestOptions.DEFAULT);
596+
581597
}
582598
}
583599

@@ -599,4 +615,4 @@ private static class TestRestHighLevelClient extends RestHighLevelClient {
599615
super(client(), restClient -> {}, X_CONTENT_ENTRIES);
600616
}
601617
}
602-
}
618+
}

0 commit comments

Comments
 (0)