|
16 | 16 | import org.junit.BeforeClass; |
17 | 17 |
|
18 | 18 | import java.io.IOException; |
| 19 | +import java.util.Collection; |
| 20 | +import java.util.LinkedList; |
19 | 21 | import java.util.List; |
20 | 22 | import java.util.Map; |
21 | 23 |
|
@@ -83,8 +85,9 @@ public void testOpenAiEmbeddings() throws IOException { |
83 | 85 | assertEquals("openai", configs.get(0).get("service")); |
84 | 86 | var serviceSettings = (Map<String, Object>) configs.get(0).get("service_settings"); |
85 | 87 | var taskSettings = (Map<String, Object>) configs.get(0).get("task_settings"); |
86 | | - var modelIdFound = serviceSettings.containsKey("model_id") || taskSettings.containsKey("model_id"); |
87 | | - assertTrue("model_id not found in config: " + configs.toString(), modelIdFound); |
| 88 | + var modelIdFound = serviceSettings.containsKey("model_id") |
| 89 | + || (taskSettings.containsKey("model") && getOldClusterTestVersion().onOrBefore(OPEN_AI_EMBEDDINGS_MODEL_SETTING_MOVED)); |
| 90 | + assertTrue("model_id not found in config: " + configs, modelIdFound); |
88 | 91 |
|
89 | 92 | assertEmbeddingInference(oldClusterId); |
90 | 93 | } else if (isUpgradedCluster()) { |
@@ -139,9 +142,11 @@ public void testOpenAiCompletions() throws IOException { |
139 | 142 |
|
140 | 143 | assertCompletionInference(oldClusterId); |
141 | 144 | } else if (isMixedCluster()) { |
142 | | - var configs = (List<Map<String, Object>>) get(testTaskType, oldClusterId).get("endpoints"); |
| 145 | + List<Map<String, Object>> configs = new LinkedList<>(); |
| 146 | + var request = get(testTaskType, oldClusterId); |
| 147 | + configs.addAll((Collection<? extends Map<String, Object>>) request.getOrDefault("endpoints", List.of())); |
143 | 148 | if (oldClusterHasFeature("gte_v" + MODELS_RENAMED_TO_ENDPOINTS) == false) { |
144 | | - configs.addAll((List<Map<String, Object>>) get(testTaskType, oldClusterId).get(old_cluster_endpoint_identifier)); |
| 149 | + configs.addAll((List<Map<String, Object>>) request.getOrDefault(old_cluster_endpoint_identifier, List.of())); |
145 | 150 | // in version 8.15, there was a breaking change where "models" was renamed to "endpoints" |
146 | 151 | } |
147 | 152 | assertEquals("openai", configs.get(0).get("service")); |
|
0 commit comments