From a0e34c4a091343f9955994d8aef84b79ada4dde9 Mon Sep 17 00:00:00 2001 From: Aurelien FOUCRET Date: Mon, 28 Oct 2024 09:22:06 +0100 Subject: [PATCH] Fixing some tests. --- .../org/elasticsearch/index/query/TermsQueryBuilderTests.java | 2 ++ .../main/java/org/elasticsearch/test/AbstractQueryTestCase.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java index e5e0305e28202..1cf2ff5614eff 100644 --- a/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java @@ -71,6 +71,7 @@ protected TermsQueryBuilder doCreateTestQueryBuilder() { // make between 0 and 5 different values of the same type String fieldName = randomValueOtherThanMany( choice -> choice.equals(GEO_POINT_FIELD_NAME) + || choice.equals(BINARY_FIELD_NAME) || choice.equals(GEO_POINT_ALIAS_FIELD_NAME) || choice.equals(INT_RANGE_FIELD_NAME) || choice.equals(DATE_ALIAS_FIELD_NAME) @@ -116,6 +117,7 @@ protected void doAssertLuceneQuery(TermsQueryBuilder queryBuilder, Query query, // we only do the check below for string fields (otherwise we'd have to decode the values) if (queryBuilder.fieldName().equals(INT_FIELD_NAME) + || queryBuilder.fieldName().equals(INT_ALIAS_FIELD_NAME) || queryBuilder.fieldName().equals(DOUBLE_FIELD_NAME) || queryBuilder.fieldName().equals(BOOLEAN_FIELD_NAME) || queryBuilder.fieldName().equals(DATE_FIELD_NAME)) { diff --git a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java index e8ca68f41854d..0d505dab40fed 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java @@ -751,6 +751,7 @@ protected static Object getRandomValueForFieldName(String fieldName) { } break; case INT_FIELD_NAME: + case INT_ALIAS_FIELD_NAME: value = randomIntBetween(0, 10); break; case DOUBLE_FIELD_NAME: @@ -815,6 +816,7 @@ protected static String getRandomRewriteMethod() { protected static Fuzziness randomFuzziness(String fieldName) { switch (fieldName) { case INT_FIELD_NAME: + case INT_ALIAS_FIELD_NAME: case DOUBLE_FIELD_NAME: case DATE_FIELD_NAME: case DATE_NANOS_FIELD_NAME: