Fix CCSDuelIT for skipped shards (#79490)

Closes #79365
This commit is contained in:
Yannick Welsch 2021-10-19 20:05:47 +02:00 committed by GitHub
parent b6439c5d97
commit b84cec60d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,6 +103,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.not;
/**
@ -438,7 +439,6 @@ public class CCSDuelIT extends ESRestTestCase {
assumeMultiClusterSetup();
SearchRequest searchRequest = initSearchRequest();
// set to a value greater than the number of shards to avoid differences due to the skipping of shards
searchRequest.setPreFilterShardSize(128);
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
boolean onlyRemote = randomBoolean();
sourceBuilder.query(new TermQueryBuilder("_index", onlyRemote ? REMOTE_INDEX_NAME : INDEX_NAME));
@ -461,7 +461,6 @@ public class CCSDuelIT extends ESRestTestCase {
});
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/79365")
public void testFieldCollapsingOneClusterHasNoResults() throws Exception {
assumeMultiClusterSetup();
SearchRequest searchRequest = initSearchRequest();
@ -771,6 +770,7 @@ public class CCSDuelIT extends ESRestTestCase {
message.compareMaps(minimizeRoundtripsResponseMap, fanOutResponseMap);
throw new AssertionError("Didn't match expected value:\n" + message);
}
assertThat(minimizeRoundtripsSearchResponse.getSkippedShards(), lessThanOrEqualTo(fanOutSearchResponse.getSkippedShards()));
}
}
@ -835,6 +835,10 @@ public class CCSDuelIT extends ESRestTestCase {
shard.remove("fetch");
}
}
Map<String, Object> shards = (Map<String, Object>)responseMap.get("_shards");
if (shards != null) {
shards.remove("skipped");
}
return responseMap;
}