Skip to content

Commit 913e668

Browse files
committed
fix ip_range testing in RangeFieldMapperTests.testIncludeInAll
1 parent 3e0943c commit 913e668

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/src/test/java/org/elasticsearch/index/mapper/RangeFieldMapperTests.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,14 @@ protected void doTestIncludeInAll(String type) throws Exception {
273273
IndexableField[] fields = doc.rootDoc().getFields("_all");
274274
assertEquals(1, fields.length);
275275

276-
assertThat(fields[0].stringValue(), containsString(type.equals("date_range") ? "1477872000000" : "5"));
276+
String strVal = "5";
277+
if (type.equals("date_range")) {
278+
strVal = "1477872000000";
279+
} else if (type.equals("ip_range")) {
280+
strVal = InetAddresses.toAddrString(InetAddresses.forString("192.168.1.7")) + " : "
281+
+ InetAddresses.toAddrString(InetAddresses.forString("2001:db8:0:0:0:0:0:0"));
282+
}
283+
assertThat(fields[0].stringValue(), containsString(strVal));
277284

278285
mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
279286
.startObject("properties").startObject("field").field("type", type);

0 commit comments

Comments
 (0)