Skip to content

Commit 99a3b14

Browse files
committed
fix tests; add permissions
1 parent 85ba05a commit 99a3b14

File tree

2 files changed

+8
-20
lines changed
  • x-pack/plugin
    • inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference
    • security/qa/operator-privileges-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/operator

2 files changed

+8
-20
lines changed

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

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public void testAttachWithModelId() throws IOException {
110110
var results = infer(inferenceId, List.of("washing machine"));
111111
assertNotNull(results.get("sparse_embedding"));
112112

113+
deleteModel(inferenceId);
114+
113115
forceStopMlNodeDeployment(deploymentId);
114116
}
115117

@@ -225,6 +227,7 @@ public void testNumAllocationsIsUpdated() throws IOException {
225227
)
226228
);
227229

230+
deleteModel(inferenceId);
228231
forceStopMlNodeDeployment(deploymentId);
229232
}
230233

@@ -266,6 +269,7 @@ public void testUpdateWhenInferenceEndpointCreatesDeployment() throws IOExceptio
266269
is(Map.of("num_allocations", 2, "num_threads", 1, "model_id", modelId))
267270
);
268271

272+
deleteModel(inferenceId);
269273
forceStopMlNodeDeployment(deploymentId);
270274
}
271275

@@ -309,6 +313,8 @@ public void testCannotUpdateAnotherInferenceEndpointsCreatedDeployment() throws
309313
)
310314
);
311315

316+
deleteModel(inferenceId);
317+
deleteModel(secondInferenceId);
312318
forceStopMlNodeDeployment(deploymentId);
313319
}
314320

@@ -331,6 +337,7 @@ public void testStoppingDeploymentAttachedToInferenceEndpoint() throws IOExcepti
331337
)
332338
);
333339

340+
deleteModel(inferenceId);
334341
// Force stop will stop the deployment
335342
forceStopMlNodeDeployment(deploymentId);
336343
}
@@ -358,16 +365,6 @@ private String endpointConfig(String modelId, String deploymentId) {
358365
""", modelId, deploymentId);
359366
}
360367

361-
private String updatedEndpointConfig(int numAllocations) {
362-
return Strings.format("""
363-
{
364-
"service_settings": {
365-
"num_allocations": %d
366-
}
367-
}
368-
""", numAllocations);
369-
}
370-
371368
private Response startMlNodeDeploymemnt(String modelId, String deploymentId) throws IOException {
372369
String endPoint = "/_ml/trained_models/"
373370
+ modelId
@@ -413,16 +410,6 @@ private Response updateMlNodeDeploymemnt(String deploymentId, int numAllocations
413410
return client().performRequest(request);
414411
}
415412

416-
private Map<String, Object> updateMlNodeDeploymemnt(String deploymentId, String body) throws IOException {
417-
String endPoint = "/_ml/trained_models/" + deploymentId + "/deployment/_update";
418-
419-
Request request = new Request("POST", endPoint);
420-
request.setJsonEntity(body);
421-
var response = client().performRequest(request);
422-
assertStatusOkOrCreated(response);
423-
return entityAsMap(response);
424-
}
425-
426413
protected void stopMlNodeDeployment(String deploymentId) throws IOException {
427414
String endpoint = "/_ml/trained_models/" + deploymentId + "/deployment/_stop";
428415
Request request = new Request("POST", endpoint);

x-pack/plugin/security/qa/operator-privileges-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/operator/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public class Constants {
174174
"cluster:admin/xpack/enrich/get",
175175
"cluster:admin/xpack/enrich/put",
176176
"cluster:admin/xpack/enrich/reindex",
177+
"cluster:admin/xpack/inference/clear_inference_endpoint_cache",
177178
"cluster:admin/xpack/inference/delete",
178179
"cluster:admin/xpack/inference/put",
179180
"cluster:admin/xpack/inference/update",

0 commit comments

Comments
 (0)