mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
Tests: Fix SearchFieldsIT.testDocValueFields (#31995)
This test produced different implementations of joda time classes, depending on if the data was serialized or not (DateTime vs MutableDateTime). This now uses a common base class to extract the milliseconds from the data. Closes #31992
This commit is contained in:
parent
4ae4ac08d5
commit
0b7e7befdd
@ -46,8 +46,7 @@ import org.elasticsearch.search.lookup.FieldLookup;
|
|||||||
import org.elasticsearch.search.sort.SortOrder;
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.InternalSettingsPlugin;
|
import org.elasticsearch.test.InternalSettingsPlugin;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.base.BaseDateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
|
||||||
|
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
@ -702,7 +701,6 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
|||||||
assertThat(fields.get("test_field").getValue(), equalTo("foobar"));
|
assertThat(fields.get("test_field").getValue(), equalTo("foobar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/31992")
|
|
||||||
public void testDocValueFields() throws Exception {
|
public void testDocValueFields() throws Exception {
|
||||||
createIndex("test");
|
createIndex("test");
|
||||||
|
|
||||||
@ -804,8 +802,8 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
|||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("long_field").getValue(), equalTo((Object) 4L));
|
assertThat(searchResponse.getHits().getAt(0).getFields().get("long_field").getValue(), equalTo((Object) 4L));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("float_field").getValue(), equalTo((Object) 5.0));
|
assertThat(searchResponse.getHits().getAt(0).getFields().get("float_field").getValue(), equalTo((Object) 5.0));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("double_field").getValue(), equalTo((Object) 6.0d));
|
assertThat(searchResponse.getHits().getAt(0).getFields().get("double_field").getValue(), equalTo((Object) 6.0d));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("date_field").getValue(),
|
BaseDateTime dateField = searchResponse.getHits().getAt(0).getFields().get("date_field").getValue();
|
||||||
equalTo(new DateTime(date.toInstant().toEpochMilli(), DateTimeZone.UTC)));
|
assertThat(dateField.getMillis(), equalTo(date.toInstant().toEpochMilli()));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("boolean_field").getValue(), equalTo((Object) true));
|
assertThat(searchResponse.getHits().getAt(0).getFields().get("boolean_field").getValue(), equalTo((Object) true));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("text_field").getValue(), equalTo("foo"));
|
assertThat(searchResponse.getHits().getAt(0).getFields().get("text_field").getValue(), equalTo("foo"));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getFields().get("keyword_field").getValue(), equalTo("foo"));
|
assertThat(searchResponse.getHits().getAt(0).getFields().get("keyword_field").getValue(), equalTo("foo"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user