Skip to content

Commit 25a0448

Browse files
authored
Fix InferenceCrudIT.testGetServicesWithCompletionTaskType failure on non snapshot buiild (elastic#119928)
1 parent 6ca7e75 commit 25a0448

File tree

1 file changed

+15
-5
lines changed
  • x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference

1 file changed

+15
-5
lines changed

x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceCrudIT.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,29 +242,39 @@ public void testGetServicesWithRerankTaskType() throws IOException {
242242
@SuppressWarnings("unchecked")
243243
public void testGetServicesWithCompletionTaskType() throws IOException {
244244
List<Object> services = getServices(TaskType.COMPLETION);
245-
assertThat(services.size(), equalTo(10));
245+
if ((ElasticInferenceServiceFeature.DEPRECATED_ELASTIC_INFERENCE_SERVICE_FEATURE_FLAG.isEnabled()
246+
|| ElasticInferenceServiceFeature.ELASTIC_INFERENCE_SERVICE_FEATURE_FLAG.isEnabled())) {
247+
assertThat(services.size(), equalTo(10));
248+
} else {
249+
assertThat(services.size(), equalTo(9));
250+
}
246251

247252
String[] providers = new String[services.size()];
248253
for (int i = 0; i < services.size(); i++) {
249254
Map<String, Object> serviceConfig = (Map<String, Object>) services.get(i);
250255
providers[i] = (String) serviceConfig.get("service");
251256
}
252257

253-
assertArrayEquals(
254-
providers,
258+
var providerList = new ArrayList<>(
255259
List.of(
256260
"alibabacloud-ai-search",
257261
"amazonbedrock",
258262
"anthropic",
259263
"azureaistudio",
260264
"azureopenai",
261265
"cohere",
262-
"elastic",
263266
"googleaistudio",
264267
"openai",
265268
"streaming_completion_test_service"
266-
).toArray()
269+
)
267270
);
271+
272+
if ((ElasticInferenceServiceFeature.DEPRECATED_ELASTIC_INFERENCE_SERVICE_FEATURE_FLAG.isEnabled()
273+
|| ElasticInferenceServiceFeature.ELASTIC_INFERENCE_SERVICE_FEATURE_FLAG.isEnabled())) {
274+
providerList.add(6, "elastic");
275+
}
276+
277+
assertArrayEquals(providers, providerList.toArray());
268278
}
269279

270280
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)