|
41 | 41 | import org.elasticsearch.index.IndexVersion; |
42 | 42 | import org.elasticsearch.index.IndexingPressure; |
43 | 43 | import org.elasticsearch.index.mapper.InferenceMetadataFieldsMapper; |
44 | | -import org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper; |
45 | 44 | import org.elasticsearch.index.shard.ShardId; |
46 | 45 | import org.elasticsearch.inference.ChunkInferenceInput; |
47 | 46 | import org.elasticsearch.inference.ChunkedInference; |
48 | 47 | import org.elasticsearch.inference.InferenceService; |
49 | 48 | import org.elasticsearch.inference.InferenceServiceRegistry; |
50 | 49 | import org.elasticsearch.inference.MinimalServiceSettings; |
51 | 50 | import org.elasticsearch.inference.Model; |
52 | | -import org.elasticsearch.inference.SimilarityMeasure; |
53 | 51 | import org.elasticsearch.inference.TaskType; |
54 | 52 | import org.elasticsearch.inference.UnparsedModel; |
55 | 53 | import org.elasticsearch.inference.telemetry.InferenceStats; |
|
71 | 69 | import org.elasticsearch.xpack.inference.mapper.SemanticTextField; |
72 | 70 | import org.elasticsearch.xpack.inference.model.TestModel; |
73 | 71 | import org.elasticsearch.xpack.inference.registry.ModelRegistry; |
74 | | -import org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceService; |
75 | 72 | import org.junit.After; |
76 | 73 | import org.junit.Before; |
77 | 74 | import org.mockito.stubbing.Answer; |
@@ -225,62 +222,6 @@ public void testLicenseInvalidForInference() throws InterruptedException { |
225 | 222 | awaitLatch(chainExecuted, 10, TimeUnit.SECONDS); |
226 | 223 | } |
227 | 224 |
|
228 | | - @SuppressWarnings({ "unchecked", "rawtypes" }) |
229 | | - public void testLicenseInvalidForEis() throws InterruptedException { |
230 | | - final InferenceStats inferenceStats = InferenceStatsTests.mockInferenceStats(); |
231 | | - StaticModel model = new StaticModel( |
232 | | - randomAlphanumericOfLength(5), |
233 | | - TaskType.TEXT_EMBEDDING, |
234 | | - ElasticInferenceService.NAME, |
235 | | - new TestModel.TestServiceSettings("foo", 128, SimilarityMeasure.COSINE, DenseVectorFieldMapper.ElementType.BYTE), |
236 | | - new TestModel.TestTaskSettings(randomInt(3)), |
237 | | - new TestModel.TestSecretSettings(randomAlphaOfLength(4)) |
238 | | - ); |
239 | | - |
240 | | - var licenseState = MockLicenseState.createMock(); |
241 | | - when(licenseState.isAllowed(InferencePlugin.EIS_INFERENCE_FEATURE)).thenReturn(false); |
242 | | - ShardBulkInferenceActionFilter filter = createFilter( |
243 | | - threadPool, |
244 | | - Map.of(model.getInferenceEntityId(), model), |
245 | | - NOOP_INDEXING_PRESSURE, |
246 | | - useLegacyFormat, |
247 | | - licenseState, |
248 | | - inferenceStats |
249 | | - ); |
250 | | - CountDownLatch chainExecuted = new CountDownLatch(1); |
251 | | - ActionFilterChain actionFilterChain = (task, action, request, listener) -> { |
252 | | - try { |
253 | | - BulkShardRequest bulkShardRequest = (BulkShardRequest) request; |
254 | | - assertThat(bulkShardRequest.items().length, equalTo(1)); |
255 | | - |
256 | | - BulkItemResponse.Failure failure = bulkShardRequest.items()[0].getPrimaryResponse().getFailure(); |
257 | | - assertNotNull(failure); |
258 | | - assertThat(failure.getCause(), instanceOf(ElasticsearchSecurityException.class)); |
259 | | - assertThat( |
260 | | - failure.getMessage(), |
261 | | - containsString(org.elasticsearch.core.Strings.format("current license is non-compliant for [%s]", XPackField.INFERENCE)) |
262 | | - ); |
263 | | - } finally { |
264 | | - chainExecuted.countDown(); |
265 | | - } |
266 | | - |
267 | | - }; |
268 | | - ActionListener actionListener = mock(ActionListener.class); |
269 | | - Task task = mock(Task.class); |
270 | | - |
271 | | - Map<String, InferenceFieldMetadata> inferenceFieldMap = Map.of( |
272 | | - "obj.field1", |
273 | | - new InferenceFieldMetadata("obj.field1", model.getInferenceEntityId(), new String[] { "obj.field1" }, null) |
274 | | - ); |
275 | | - BulkItemRequest[] items = new BulkItemRequest[1]; |
276 | | - items[0] = new BulkItemRequest(0, new IndexRequest("test").source("obj.field1", "Test")); |
277 | | - BulkShardRequest request = new BulkShardRequest(new ShardId("test", "test", 0), WriteRequest.RefreshPolicy.NONE, items); |
278 | | - request.setInferenceFieldMap(inferenceFieldMap); |
279 | | - |
280 | | - filter.apply(task, TransportShardBulkAction.ACTION_NAME, request, actionListener, actionFilterChain); |
281 | | - awaitLatch(chainExecuted, 10, TimeUnit.SECONDS); |
282 | | - } |
283 | | - |
284 | 225 | @SuppressWarnings({ "unchecked", "rawtypes" }) |
285 | 226 | public void testInferenceNotFound() throws Exception { |
286 | 227 | final InferenceStats inferenceStats = InferenceStatsTests.mockInferenceStats(); |
|
0 commit comments