Skip to content

Commit a259e9e

Browse files
[ML] Initialize backing indices before running integration test (#137122)
* Adding endpoint creation prior to tests * Moving to test that is failing * Deleting endpoint after creating it
1 parent e24ea4b commit a259e9e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ tests:
110110
issue: https://github.com/elastic/elasticsearch/issues/120339
111111
- class: org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeToCharProcessorTests
112112
issue: https://github.com/elastic/elasticsearch/issues/120575
113-
- class: org.elasticsearch.xpack.inference.DefaultEndPointsIT
114-
method: testMultipleInferencesTriggeringDownloadAndDeploy
115-
issue: https://github.com/elastic/elasticsearch/issues/120668
116113
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
117114
method: test {p0=ml/3rd_party_deployment/Test start deployment fails while model download in progress}
118115
issue: https://github.com/elastic/elasticsearch/issues/120810

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.concurrent.CountDownLatch;
2626

2727
import static org.hamcrest.Matchers.empty;
28-
import static org.hamcrest.Matchers.equalTo;
2928
import static org.hamcrest.Matchers.hasSize;
3029
import static org.hamcrest.Matchers.is;
3130
import static org.hamcrest.Matchers.oneOf;
@@ -75,7 +74,7 @@ public void testDefaultModels() throws IOException {
7574

7675
putModel("my-model", mockCompletionServiceModelConfig(TaskType.SPARSE_EMBEDDING, "streaming_completion_test_service"));
7776
var registeredModels = getMinimalConfigs();
78-
assertThat(registeredModels.size(), equalTo(1));
77+
assertThat(registeredModels.size(), is(1));
7978
assertTrue(registeredModels.containsKey("my-model"));
8079
assertFalse(registeredModels.containsKey(ElasticsearchInternalService.DEFAULT_E5_ID));
8180
assertFalse(registeredModels.containsKey(ElasticsearchInternalService.DEFAULT_ELSER_ID));
@@ -194,7 +193,14 @@ private static void assertDefaultChunkingSettings(Map<String, Object> modelConfi
194193
);
195194
}
196195

197-
public void testMultipleInferencesTriggeringDownloadAndDeploy() throws InterruptedException {
196+
public void testMultipleInferencesTriggeringDownloadAndDeploy() throws InterruptedException, IOException {
197+
var initialEndpointId = "initial-model";
198+
// Creating an inference endpoint to force the backing indices to be created to reduce the likelihood of the test failing
199+
// because it's trying to interact with the indices while they're being created.
200+
putModel(initialEndpointId, mockCompletionServiceModelConfig(TaskType.SPARSE_EMBEDDING, "streaming_completion_test_service"));
201+
// delete model so it doesn't affect other tests
202+
deleteModel(initialEndpointId);
203+
198204
int numParallelRequests = 4;
199205
var latch = new CountDownLatch(numParallelRequests);
200206
var errors = new ArrayList<Exception>();

0 commit comments

Comments
 (0)