diff --git a/x-pack/plugin/inference/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/application/OpenAiServiceUpgradeIT.java b/x-pack/plugin/inference/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/application/OpenAiServiceUpgradeIT.java index 7b43a5b86e619..0af485722a733 100644 --- a/x-pack/plugin/inference/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/application/OpenAiServiceUpgradeIT.java +++ b/x-pack/plugin/inference/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/xpack/application/OpenAiServiceUpgradeIT.java @@ -16,6 +16,8 @@ import org.junit.BeforeClass; import java.io.IOException; +import java.util.Collection; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -139,9 +141,11 @@ public void testOpenAiCompletions() throws IOException { assertCompletionInference(oldClusterId); } else if (isMixedCluster()) { - var configs = (List>) get(testTaskType, oldClusterId).get("endpoints"); + List> configs = new LinkedList<>(); + var request = get(testTaskType, oldClusterId); + configs.addAll((Collection>) request.getOrDefault("endpoints", List.of())); if (oldClusterHasFeature("gte_v" + MODELS_RENAMED_TO_ENDPOINTS) == false) { - configs.addAll((List>) get(testTaskType, oldClusterId).get(old_cluster_endpoint_identifier)); + configs.addAll((List>) request.getOrDefault(old_cluster_endpoint_identifier, List.of())); // in version 8.15, there was a breaking change where "models" was renamed to "endpoints" } assertEquals("openai", configs.get(0).get("service"));