From 5329c6699e170d7c0b05a979b6df06fe7abc9a32 Mon Sep 17 00:00:00 2001 From: Rishabh Maurya Date: Mon, 25 Mar 2024 10:56:28 -0700 Subject: [PATCH] Fix test failures Signed-off-by: Rishabh Maurya --- .../org/opensearch/index/mapper/ObjectMapperTests.java | 8 ++++---- .../search/aggregations/AggregatorTestCase.java | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/test/java/org/opensearch/index/mapper/ObjectMapperTests.java b/server/src/test/java/org/opensearch/index/mapper/ObjectMapperTests.java index abdfe577d225a..b10a7d8155056 100644 --- a/server/src/test/java/org/opensearch/index/mapper/ObjectMapperTests.java +++ b/server/src/test/java/org/opensearch/index/mapper/ObjectMapperTests.java @@ -447,7 +447,7 @@ public void testDerivedFields() throws Exception { .startObject("tweet") .startObject("derived") .startObject("derived_field_name1") - .field("type", "text") + .field("type", "boolean") .endObject() .startObject("derived_field_name2") .field("type", "keyword") @@ -458,7 +458,7 @@ public void testDerivedFields() throws Exception { .endObject() .startObject("properties") .startObject("field_name") - .field("type", "text") + .field("type", "date") .endObject() .endObject() .endObject() @@ -472,7 +472,7 @@ public void testDerivedFields() throws Exception { Mapper mapper = documentMapper.root().getMapper("derived_field_name1"); assertTrue(mapper instanceof DerivedFieldMapper); DerivedFieldMapper derivedFieldMapper = (DerivedFieldMapper) mapper; - assertEquals("text", derivedFieldMapper.getType()); + assertEquals("boolean", derivedFieldMapper.getType()); assertNull(derivedFieldMapper.getScript()); mapper = documentMapper.root().getMapper("derived_field_name2"); @@ -484,7 +484,7 @@ public void testDerivedFields() throws Exception { // Check that field in properties was parsed correctly as well mapper = documentMapper.root().getMapper("field_name"); assertNotNull(mapper); - assertEquals("text", mapper.typeName()); + assertEquals("date", mapper.typeName()); } @Override diff --git a/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java index 4eb49ebb42241..fcc4f9cd989ec 100644 --- a/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java +++ b/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java @@ -97,6 +97,7 @@ import org.opensearch.index.mapper.CompletionFieldMapper; import org.opensearch.index.mapper.ContentPath; import org.opensearch.index.mapper.DateFieldMapper; +import org.opensearch.index.mapper.DerivedFieldMapper; import org.opensearch.index.mapper.FieldAliasMapper; import org.opensearch.index.mapper.FieldMapper; import org.opensearch.index.mapper.GeoPointFieldMapper; @@ -198,6 +199,7 @@ public abstract class AggregatorTestCase extends OpenSearchTestCase { denylist.add(ObjectMapper.NESTED_CONTENT_TYPE); // TODO support for nested denylist.add(CompletionFieldMapper.CONTENT_TYPE); // TODO support completion denylist.add(FieldAliasMapper.CONTENT_TYPE); // TODO support alias + denylist.add(DerivedFieldMapper.CONTENT_TYPE); // TODO support derived fields TYPE_TEST_DENYLIST = denylist; }