From 5b96f6c74573001829ce748fcec951e86614c454 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 21 Oct 2024 12:25:51 +1300 Subject: [PATCH] Fix test Signed-off-by: Thomas Farr --- .../integTest/AbstractSearchTemplateRequestIT.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java index efa2298046..3eded51b99 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java @@ -12,6 +12,7 @@ import java.util.List; import java.util.Map; import org.junit.Test; +import org.opensearch.Version; import org.opensearch.client.json.JsonData; import org.opensearch.client.opensearch._types.Refresh; import org.opensearch.client.opensearch._types.mapping.Property; @@ -89,6 +90,14 @@ public void testTemplateSearchAggregations() throws Exception { @Test public void testMultiSearchTemplate() throws Exception { + Integer expectedSuccessStatus = null; + Integer expectedFailureStatus = null; + + if (getServerVersion().onOrAfter(Version.V_2_18_0)) { + expectedSuccessStatus = 200; + expectedFailureStatus = 404; + } + var index = "test-msearch-template"; createDocuments(index); @@ -120,11 +129,11 @@ public void testMultiSearchTemplate() throws Exception { assertEquals(2, searchResponse.responses().size()); var response = searchResponse.responses().get(0); assertTrue(response.isResult()); - assertNull(response.result().status()); + assertEquals(expectedSuccessStatus, response.result().status()); assertEquals(4, response.result().hits().hits().size()); var failureResponse = searchResponse.responses().get(1); assertTrue(failureResponse.isFailure()); - assertNull(failureResponse.failure().status()); + assertEquals(expectedFailureStatus, failureResponse.failure().status()); } private SearchTemplateResponse sendTemplateRequest(String index, String title, boolean suggs, boolean aggs)