From c614960c713dc5ea84c4e83d8c24a2a3d4ff06a6 Mon Sep 17 00:00:00 2001 From: Nathalie Jonathan Date: Mon, 17 Mar 2025 12:45:27 -0700 Subject: [PATCH 1/2] Fix test_cohereInference_withDifferent_postProcessFunction flaky test Signed-off-by: Nathalie Jonathan --- .../java/org/opensearch/ml/rest/RestCohereInferenceIT.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java index a997f4cb48..c7817b9524 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java @@ -78,7 +78,9 @@ public void test_cohereInference_withDifferent_postProcessFunction() { List output = (List) inferenceResult.get("inference_results"); assertEquals(errorMsg, 1, output.size()); assertTrue(errorMsg, output.get(0) instanceof Map); - validateOutput(errorMsg, (Map) output.get(0), DATA_TYPE.get(postProcessFunction)); + if (output != null && DATA_TYPE != null) { + validateOutput(errorMsg, (Map) output.get(0), DATA_TYPE.get(postProcessFunction)); + } } } From fb59fb3ace73dcd342b9a2a19b4ddad936fad3f7 Mon Sep 17 00:00:00 2001 From: Nathalie Jonathan Date: Mon, 17 Mar 2025 15:21:47 -0700 Subject: [PATCH 2/2] Apply feedback Signed-off-by: Nathalie Jonathan --- .../test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java index c7817b9524..518afee5d9 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestCohereInferenceIT.java @@ -78,7 +78,7 @@ public void test_cohereInference_withDifferent_postProcessFunction() { List output = (List) inferenceResult.get("inference_results"); assertEquals(errorMsg, 1, output.size()); assertTrue(errorMsg, output.get(0) instanceof Map); - if (output != null && DATA_TYPE != null) { + if (output != null) { validateOutput(errorMsg, (Map) output.get(0), DATA_TYPE.get(postProcessFunction)); } }