Skip to content

Commit 6432240

Browse files
author
Max Hniebergall
committed
start to handle mixed cluster failures for new mapping
1 parent 7f11346 commit 6432240

File tree

1 file changed

+14
-2
lines changed
  • x-pack/plugin/inference/qa/mixed-cluster/src/javaRestTest/java/org/elasticsearch/xpack/inference/qa/mixed

1 file changed

+14
-2
lines changed

x-pack/plugin/inference/qa/mixed-cluster/src/javaRestTest/java/org/elasticsearch/xpack/inference/qa/mixed/OpenAIServiceMixedIT.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class OpenAIServiceMixedIT extends BaseMixedTestCase {
3232
private static final String OPEN_AI_EMBEDDINGS_CHUNKING_SETTINGS_ADDED = "8.16.0";
3333
private static final String OPEN_AI_COMPLETIONS_ADDED = "8.14.0";
3434
private static final String MINIMUM_SUPPORTED_VERSION = "8.15.0";
35+
private static final String ENDPOINT_VERSION_ADDED = "8.16.0";
3536

3637
private static MockWebServer openAiEmbeddingsServer;
3738
private static MockWebServer openAiChatCompletionsServer;
@@ -115,8 +116,19 @@ public void testOpenAiCompletions() throws IOException {
115116

116117
// queue a response as PUT will call the service
117118
openAiChatCompletionsServer.enqueue(new MockResponse().setResponseCode(200).setBody(chatCompletionsResponse()));
118-
put(inferenceId, chatCompletionsConfig(getUrl(openAiChatCompletionsServer)), TaskType.COMPLETION);
119-
119+
try {
120+
put(inferenceId, chatCompletionsConfig(getUrl(openAiChatCompletionsServer)), TaskType.COMPLETION);
121+
} catch (Exception e) {
122+
if (bwcVersion.before(Version.fromString(ENDPOINT_VERSION_ADDED))) {
123+
// endpoint version was added in 8.16.0. if the version is before that, an exception will be thrown if the index mapping
124+
// was created based on a mapping from an old node
125+
assertThat(
126+
e.getMessage(),
127+
containsString("Please update all nodes in your cluster to the latest version to put inference endpoints.")
128+
);
129+
return;
130+
}
131+
}
120132
var configsMap = get(TaskType.COMPLETION, inferenceId);
121133
logger.warn("Configs: {}", configsMap);
122134
var configs = (List<Map<String, Object>>) configsMap.get("endpoints");

0 commit comments

Comments
 (0)