Skip to content

Commit b84cec6

Browse files
authored
Fix CCSDuelIT for skipped shards (#79490)
Closes #79365
1 parent b6439c5 commit b84cec6

File tree

1 file changed

+6
-2
lines changed
  • qa/multi-cluster-search/src/test/java/org/elasticsearch/search

1 file changed

+6
-2
lines changed

qa/multi-cluster-search/src/test/java/org/elasticsearch/search/CCSDuelIT.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
import static org.hamcrest.Matchers.empty;
104104
import static org.hamcrest.Matchers.greaterThan;
105105
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
106+
import static org.hamcrest.Matchers.lessThanOrEqualTo;
106107
import static org.hamcrest.Matchers.not;
107108

108109
/**
@@ -438,7 +439,6 @@ public void testSortByFieldOneClusterHasNoResults() throws Exception {
438439
assumeMultiClusterSetup();
439440
SearchRequest searchRequest = initSearchRequest();
440441
// set to a value greater than the number of shards to avoid differences due to the skipping of shards
441-
searchRequest.setPreFilterShardSize(128);
442442
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
443443
boolean onlyRemote = randomBoolean();
444444
sourceBuilder.query(new TermQueryBuilder("_index", onlyRemote ? REMOTE_INDEX_NAME : INDEX_NAME));
@@ -461,7 +461,6 @@ public void testSortByFieldOneClusterHasNoResults() throws Exception {
461461
});
462462
}
463463

464-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/79365")
465464
public void testFieldCollapsingOneClusterHasNoResults() throws Exception {
466465
assumeMultiClusterSetup();
467466
SearchRequest searchRequest = initSearchRequest();
@@ -771,6 +770,7 @@ private static void duelSearch(SearchRequest searchRequest, Consumer<SearchRespo
771770
message.compareMaps(minimizeRoundtripsResponseMap, fanOutResponseMap);
772771
throw new AssertionError("Didn't match expected value:\n" + message);
773772
}
773+
assertThat(minimizeRoundtripsSearchResponse.getSkippedShards(), lessThanOrEqualTo(fanOutSearchResponse.getSkippedShards()));
774774
}
775775
}
776776

@@ -835,6 +835,10 @@ private static Map<String, Object> responseToMap(SearchResponse response) throws
835835
shard.remove("fetch");
836836
}
837837
}
838+
Map<String, Object> shards = (Map<String, Object>)responseMap.get("_shards");
839+
if (shards != null) {
840+
shards.remove("skipped");
841+
}
838842
return responseMap;
839843
}
840844

0 commit comments

Comments
 (0)