-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unsupported Version.V_5_* #32937
Changes from 6 commits
2160102
18c82ef
db034af
9310aed
dfb2f34
66d613a
03b8fe1
42d237d
faf42cc
f65a2b7
fefd689
50d9ef8
fac4e45
40d70b4
ea5c278
ac0576d
bb0dadd
75f8891
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,13 +136,15 @@ public void testInitialSearchParamsFields() { | |
// Test stored_fields for versions that support it | ||
searchRequest = new SearchRequest().source(new SearchSourceBuilder()); | ||
searchRequest.source().storedField("_source").storedField("_id"); | ||
remoteVersion = Version.fromId(between(Version.V_5_0_0_alpha4_ID, Version.CURRENT.id)); | ||
// V_5_0_0_alpha4 => current | ||
remoteVersion = Version.fromId(between(5000004, Version.CURRENT.id)); | ||
assertThat(initialSearch(searchRequest, query, remoteVersion).getParameters(), hasEntry("stored_fields", "_source,_id")); | ||
|
||
// Test fields for versions that support it | ||
searchRequest = new SearchRequest().source(new SearchSourceBuilder()); | ||
searchRequest.source().storedField("_source").storedField("_id"); | ||
remoteVersion = Version.fromId(between(2000099, Version.V_5_0_0_alpha4_ID - 1)); | ||
// V_2_0_0 => V_5_0_0_alpha3 | ||
remoteVersion = Version.fromId(between(2000099, 5000003)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
assertThat(initialSearch(searchRequest, query, remoteVersion).getParameters(), hasEntry("fields", "_source,_id")); | ||
|
||
// Test extra fields for versions that need it | ||
|
@@ -190,7 +192,8 @@ public void testInitialSearchParamsMisc() { | |
} | ||
|
||
private void assertScroll(Version remoteVersion, Map<String, String> params, TimeValue requested) { | ||
if (remoteVersion.before(Version.V_5_0_0)) { | ||
// V_5_0_0 | ||
if (remoteVersion.before(Version.fromId(5000099))) { | ||
// Versions of Elasticsearch prior to 5.0 can't parse nanos or micros in TimeValue. | ||
assertThat(params.get("scroll"), not(either(endsWith("nanos")).or(endsWith("micros")))); | ||
if (requested.getStringRep().endsWith("nanos") || requested.getStringRep().endsWith("micros")) { | ||
|
@@ -242,7 +245,7 @@ public void testScrollParams() { | |
|
||
public void testScrollEntity() throws IOException { | ||
String scroll = randomAlphaOfLength(30); | ||
HttpEntity entity = scroll(scroll, timeValueMillis(between(1, 1000)), Version.V_5_0_0).getEntity(); | ||
HttpEntity entity = scroll(scroll, timeValueMillis(between(1, 1000)), Version.fromString("5.0.0")).getEntity(); | ||
assertEquals(ContentType.APPLICATION_JSON.toString(), entity.getContentType().getValue()); | ||
assertThat(Streams.copyToString(new InputStreamReader(entity.getContent(), StandardCharsets.UTF_8)), | ||
containsString("\"" + scroll + "\"")); | ||
|
@@ -255,7 +258,7 @@ public void testScrollEntity() throws IOException { | |
|
||
public void testClearScroll() throws IOException { | ||
String scroll = randomAlphaOfLength(30); | ||
Request request = clearScroll(scroll, Version.V_5_0_0); | ||
Request request = clearScroll(scroll, Version.fromString("5.0.0")); | ||
assertEquals(ContentType.APPLICATION_JSON.toString(), request.getEntity().getContentType().getValue()); | ||
assertThat(Streams.copyToString(new InputStreamReader(request.getEntity().getContent(), StandardCharsets.UTF_8)), | ||
containsString("\"" + scroll + "\"")); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,13 +150,15 @@ public void testLookupRemoteVersion() throws Exception { | |
assertTrue(called.get()); | ||
called.set(false); | ||
sourceWithMockedRemoteCall(false, ContentType.APPLICATION_JSON, "main/5_0_0_alpha_3.json").lookupRemoteVersion(v -> { | ||
assertEquals(Version.V_5_0_0_alpha3, v); | ||
// V_5_0_0_alpha3 | ||
assertEquals(Version.fromId(5000003), v); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a comment about the version it maps to? |
||
called.set(true); | ||
}); | ||
assertTrue(called.get()); | ||
called.set(false); | ||
sourceWithMockedRemoteCall(false, ContentType.APPLICATION_JSON, "main/with_unknown_fields.json").lookupRemoteVersion(v -> { | ||
assertEquals(Version.V_5_0_0_alpha3, v); | ||
// V_5_0_0_alpha3 | ||
assertEquals(Version.fromId(5000003), v); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
called.set(true); | ||
}); | ||
assertTrue(called.get()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the version it maps to as a comment?