Skip to content

Commit

Permalink
Fix buggy test
Browse files Browse the repository at this point in the history
In #64374 I broke a test that serializes `SearchRequest` with a random
version. I'm unsure how we didn't catch this in the PR tests but
computers are tricky. This fixes the test by removing runtime mappings
for versions that don't support it.
  • Loading branch information
nik9000 committed Nov 10, 2020
1 parent 7bf35ff commit 724b244
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public void testSerialization() throws Exception {
public void testRandomVersionSerialization() throws IOException {
SearchRequest searchRequest = createSearchRequest();
Version version = VersionUtils.randomVersion(random());
if (version.before(Version.V_8_0_0) && searchRequest.source() != null) {
// Versions before 8.0.0 don't support runtime mappings
searchRequest.source().runtimeMappings(emptyMap());
}
SearchRequest deserializedRequest = copyWriteable(searchRequest, namedWriteableRegistry, SearchRequest::new, version);
assertEquals(searchRequest.isCcsMinimizeRoundtrips(), deserializedRequest.isCcsMinimizeRoundtrips());
assertEquals(searchRequest.getLocalClusterAlias(), deserializedRequest.getLocalClusterAlias());
Expand Down

0 comments on commit 724b244

Please sign in to comment.