Skip to content
Snippets Groups Projects
Commit 013a8f57 authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

Merge branch 'fix-int-test-ordering' into 'master'


Ensure correct ordering for tests that rely on Elasticsearch response order

See merge request !884

(cherry picked from commit 1f87d450)

e7601a8e enforce correct ordering for tests that rely on ordering

Co-authored-by: Rustam Lotsmanenko (EPAM)'s avatarRustam Lotsmanenko (EPAM) <rustam_lotsmanenko@epam.com>
parent 3f7ba9b0
No related branches found
No related tags found
1 merge request!885Cherry-pick: Ensure correct ordering for tests that rely on Elasticsearch response order
Pipeline #314558 passed
......@@ -19,8 +19,10 @@ package org.opengroup.osdu.util;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch._types.ElasticsearchException;
import co.elastic.clients.elasticsearch._types.FieldSort;
import co.elastic.clients.elasticsearch._types.FieldValue;
import co.elastic.clients.elasticsearch._types.GeoShapeRelation;
import co.elastic.clients.elasticsearch._types.SortOptions;
import co.elastic.clients.elasticsearch._types.Time;
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
import co.elastic.clients.elasticsearch._types.query_dsl.*;
......@@ -512,7 +514,13 @@ public class ElasticUtils {
try {
ElasticsearchClient client = this.getOrCreateClient(username, password, host);
SearchRequest request = SearchRequest.of(builder -> builder.index(index));
SortOptions idSort = SortOptions.of(
sortBuilder -> sortBuilder.field(
FieldSort.of(fieldSortBuilder -> fieldSortBuilder.field("id"))
)
);
SearchRequest request = SearchRequest.of(builder -> builder.index(index).sort(idSort));
SearchResponse<RecordData> searchResponse = client.search(request, RecordData.class);
HitsMetadata<RecordData> hits = searchResponse.hits();
......
......@@ -21,8 +21,10 @@ import static org.opengroup.osdu.common.RecordSteps.X_COLLABORATION;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch._types.ElasticsearchException;
import co.elastic.clients.elasticsearch._types.FieldSort;
import co.elastic.clients.elasticsearch._types.FieldValue;
import co.elastic.clients.elasticsearch._types.GeoShapeRelation;
import co.elastic.clients.elasticsearch._types.SortOptions;
import co.elastic.clients.elasticsearch._types.Time;
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery;
......@@ -542,7 +544,13 @@ public class ElasticUtils {
try {
ElasticsearchClient client = this.getOrCreateClient(username, password, host);
SearchRequest request = SearchRequest.of(builder -> builder.index(index));
SortOptions idSort = SortOptions.of(
sortBuilder -> sortBuilder.field(
FieldSort.of(fieldSortBuilder -> fieldSortBuilder.field("id"))
)
);
SearchRequest request = SearchRequest.of(builder -> builder.index(index).sort(idSort));
SearchResponse<RecordData> searchResponse = client.search(request, RecordData.class);
HitsMetadata<RecordData> hits = searchResponse.hits();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment