From ac73c2679cc150df8c1aeedaa5e90d4c3c0dd6f1 Mon Sep 17 00:00:00 2001 From: Kshitij Tandon Date: Fri, 27 Sep 2024 17:24:20 +0530 Subject: [PATCH] Fixing an issue in the integration test Signed-off-by: Kshitij Tandon --- .../rollup/interceptor/RollupInterceptorIT.kt | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt b/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt index 9752f5345..ffaca1ff8 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt @@ -1040,12 +1040,12 @@ class RollupInterceptorIT : RollupRestTestCase() { }, "aggs": { "sum_passenger_count": { "sum": { "field": "passenger_count" } }, - "max_passenger_count": { "max": { "field": "passenger_count" } }, - "value_count_passenger_count": { "value_count": { "field": "passenger_count" } } + "max_passenger_count": { "max": { "field": "passenger_count" } } } } - """.trimIndent() - // Search 1 non-rollup index and 1 rollup + """.trimIndent() +// Search 1 non-rollup index and 1 rollup + updateSearchRawRollupClusterSetting(false) val searchResult1 = client().makeRequest("POST", "/$sourceIndex2,$targetIndex2/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON)) assertTrue(searchResult1.restStatus() == RestStatus.OK) val failures = extractFailuresFromSearchResponse(searchResult1) @@ -1067,13 +1067,12 @@ class RollupInterceptorIT : RollupRestTestCase() { assertTrue(rawRes1.restStatus() == RestStatus.OK) val rawRes2 = client().makeRequest("POST", "/$targetIndex2/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON)) assertTrue(rawRes2.restStatus() == RestStatus.OK) - val searchResult2 = client().makeRequest("POST", "/$sourceIndex2,$targetIndex2/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON)) - assertTrue(searchResult2.restStatus() == RestStatus.OK) + val searchResult = client().makeRequest("POST", "/$sourceIndex2,$targetIndex2/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON)) + assertTrue(searchResult.restStatus() == RestStatus.OK) val rawAgg1Res = rawRes1.asMap()["aggregations"] as Map> val rawAgg2Res = rawRes2.asMap()["aggregations"] as Map> - val rollupAggResMulti = searchResult2.asMap()["aggregations"] as Map> + val rollupAggResMulti = searchResult.asMap()["aggregations"] as Map> - val trueAggCount = rawAgg1Res.getValue("value_count_passenger_count")["value"] as Int + rawAgg2Res.getValue("value_count_passenger_count")["value"] as Int val trueAggSum = rawAgg1Res.getValue("sum_passenger_count")["value"] as Double + rawAgg2Res.getValue("sum_passenger_count")["value"] as Double assertEquals( @@ -1084,10 +1083,6 @@ class RollupInterceptorIT : RollupRestTestCase() { "Searching rollup target index did not return the sum for all of the rollup jobs on the index", trueAggSum, rollupAggResMulti.getValue("sum_passenger_count")["value"], ) - assertEquals( - "Searching rollup target index did not return the value count for all of the rollup jobs on the index", - trueAggCount, rollupAggResMulti.getValue("value_count_passenger_count")["value"], - ) // Search 2 rollups with different mappings try {