Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,12 @@ tests:
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
method: test {csv-spec:unmapped-nullify.TsWithAggsByMissing}
issue: https://github.com/elastic/elasticsearch/issues/142762
- class: org.elasticsearch.xpack.inference.integration.AuthorizationTaskExecutorIT
method: testCreatesEisChatCompletionEndpoint
issue: https://github.com/elastic/elasticsearch/issues/140849
- class: org.elasticsearch.xpack.inference.external.http.sender.RequestExecutorServiceTests
method: testExecute_Throws_WhenRateLimitedQueueIsFull
issue: https://github.com/elastic/elasticsearch/issues/141231
- class: org.elasticsearch.xpack.esql.spatial.SpatialPushDownGeoShapeIT
method: testQuantizedXY
issue: https://github.com/elastic/elasticsearch/issues/141234
- class: org.elasticsearch.xpack.inference.integration.AuthorizationTaskExecutorIT
method: testCreatesChatCompletion_AndThenCreatesTextEmbedding
issue: https://github.com/elastic/elasticsearch/issues/138012
- class: org.elasticsearch.compute.operator.topn.TopNOomRaceTests
method: testRace {repeats = 15}
issue: https://github.com/elastic/elasticsearch/issues/141471
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequestBuilder;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequestBuilder;
import org.elasticsearch.action.search.SearchPhaseExecutionException;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.internal.AdminClient;
import org.elasticsearch.common.settings.Settings;
Expand Down Expand Up @@ -53,6 +54,7 @@
import static org.elasticsearch.xpack.inference.services.elastic.response.ElasticInferenceServiceAuthorizationResponseEntityTests.RERANK_V1_ENDPOINT_ID;
import static org.elasticsearch.xpack.inference.services.elastic.response.ElasticInferenceServiceAuthorizationResponseEntityTests.getEisRainbowSprinklesAuthorizationResponse;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

Expand Down Expand Up @@ -83,9 +85,13 @@ public static void initClass() throws IOException {
}

@Before
public void createComponents() {
public void createComponents() throws Exception {
modelRegistry = node().injector().getInstance(ModelRegistry.class);
authorizationTaskExecutor = node().injector().getInstance(AuthorizationTaskExecutor.class);

// Wait for inference indices to be created
assertBusy(() -> getEisEndpoints());
ensureNoInitializingShards();
}

@After
Expand Down Expand Up @@ -212,8 +218,15 @@ static List<UnparsedModel> getEisEndpoints(ModelRegistry modelRegistry) {
var listener = new PlainActionFuture<List<UnparsedModel>>();
modelRegistry.getAllModels(true, listener);

var endpoints = listener.actionGet(TimeValue.THIRTY_SECONDS);
return endpoints.stream().filter(m -> m.service().equals(ElasticInferenceService.NAME)).toList();
try {
var endpoints = listener.actionGet(TimeValue.THIRTY_SECONDS);
return endpoints.stream().filter(m -> m.service().equals(ElasticInferenceService.NAME)).toList();
} catch (SearchPhaseExecutionException e) {
// This can happen if the internal inference indices shards have not been initialized yet.
// We fail so that when this is called in assertBusy we can retry.
fail();
return List.of();
}
}

private void restartPollingTaskAndWaitForAuthResponse() throws Exception {
Expand Down Expand Up @@ -329,6 +342,9 @@ public void testCreatesChatCompletion_AndThenCreatesTextEmbedding() throws Excep
restartPollingTaskAndWaitForAuthResponse();
assertWebServerReceivedRequest();

// Wait for the text embedding endpoint to be created
assertBusy(() -> assertThat(getEisEndpoints(), hasSize(2)));

var eisEndpoints = getEisEndpoints().stream().collect(Collectors.toMap(UnparsedModel::inferenceEntityId, Function.identity()));
assertThat(eisEndpoints.size(), is(2));

Expand Down
Loading