Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.17] Fix bug in InferenceUpgradeTestCase.getConfigsWithBreakingChangeHandling (#118624) #118663

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static org.elasticsearch.core.Strings.format;

Expand Down Expand Up @@ -112,13 +111,10 @@ protected void put(String inferenceId, String modelConfig, TaskType taskType) th
@SuppressWarnings("unchecked")
// in version 8.15, there was a breaking change where "models" was renamed to "endpoints"
LinkedList<Map<String, Object>> getConfigsWithBreakingChangeHandling(TaskType testTaskType, String oldClusterId) throws IOException {

var response = get(testTaskType, oldClusterId);
LinkedList<Map<String, Object>> configs;
configs = new LinkedList<>(
(List<Map<String, Object>>) Objects.requireNonNullElse((get(testTaskType, oldClusterId).get("endpoints")), List.of())
);
configs.addAll(Objects.requireNonNullElse((List<Map<String, Object>>) get(testTaskType, oldClusterId).get("models"), List.of()));

configs = new LinkedList<>((List<Map<String, Object>>) response.getOrDefault("endpoints", List.of()));
configs.addAll((List<Map<String, Object>>) response.getOrDefault("models", List.of()));
return configs;
}
}