|
25 | 25 | import java.util.concurrent.CountDownLatch; |
26 | 26 |
|
27 | 27 | import static org.hamcrest.Matchers.empty; |
28 | | -import static org.hamcrest.Matchers.equalTo; |
29 | 28 | import static org.hamcrest.Matchers.hasSize; |
30 | 29 | import static org.hamcrest.Matchers.is; |
31 | 30 | import static org.hamcrest.Matchers.oneOf; |
@@ -75,7 +74,7 @@ public void testDefaultModels() throws IOException { |
75 | 74 |
|
76 | 75 | putModel("my-model", mockCompletionServiceModelConfig(TaskType.SPARSE_EMBEDDING, "streaming_completion_test_service")); |
77 | 76 | var registeredModels = getMinimalConfigs(); |
78 | | - assertThat(registeredModels.size(), equalTo(1)); |
| 77 | + assertThat(registeredModels.size(), is(1)); |
79 | 78 | assertTrue(registeredModels.containsKey("my-model")); |
80 | 79 | assertFalse(registeredModels.containsKey(ElasticsearchInternalService.DEFAULT_E5_ID)); |
81 | 80 | assertFalse(registeredModels.containsKey(ElasticsearchInternalService.DEFAULT_ELSER_ID)); |
@@ -194,7 +193,14 @@ private static void assertDefaultChunkingSettings(Map<String, Object> modelConfi |
194 | 193 | ); |
195 | 194 | } |
196 | 195 |
|
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 | + |
198 | 204 | int numParallelRequests = 4; |
199 | 205 | var latch = new CountDownLatch(numParallelRequests); |
200 | 206 | var errors = new ArrayList<Exception>(); |
|
0 commit comments