Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Oct 1, 2024
1 parent d38471a commit ec9e8fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static class Request extends AcknowledgedRequest<Request> {
private final String inferenceEntityId;
private final BytesReference content;
private final XContentType contentType;
private final boolean isInternalRequest = true;

public Request(TaskType taskType, String inferenceEntityId, BytesReference content, XContentType contentType) {
super(TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUT, DEFAULT_ACK_TIMEOUT);
Expand Down Expand Up @@ -87,7 +86,7 @@ public void writeTo(StreamOutput out) throws IOException {
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = new ActionRequestValidationException();
if (isInternalRequest == false && MlStrings.isValidId(this.inferenceEntityId) == false) {
if (MlStrings.isValidId(this.inferenceEntityId) == false) {
validationException.addValidationError(Messages.getMessage(Messages.INVALID_ID, "inference_id", this.inferenceEntityId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testInferCreatesDefaultElser() throws IOException {

public void testScaleFrom0() {
assumeTrue("Default config requires a feature flag", DefaultElserFeatureFlag.isEnabled());
fail("how can we test this when we need to wait for the cooldown");
// fail("how can we test this when we need to wait for the cooldown");
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ public void testGet() throws IOException {
}

var getAllModels = getAllModels();
assertThat(getAllModels, hasSize(9));
int numModels = DefaultElserFeatureFlag.isEnabled() ? 10 : 9;
assertThat(getAllModels, hasSize(numModels));

var getSparseModels = getModels("_all", TaskType.SPARSE_EMBEDDING);
assertThat(getSparseModels, hasSize(5));
int numSparseModels = DefaultElserFeatureFlag.isEnabled() ? 6 : 5;
assertThat(getSparseModels, hasSize(numSparseModels));
for (var sparseModel : getSparseModels) {
assertEquals("sparse_embedding", sparseModel.get("task_type"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,18 @@
- do:
inference.get:
inference_id: "*"
- length: { endpoints: 0}
- length: { endpoints: 1}
- match: { endpoints.0.inference_id: ".default-elser-2" }

- do:
inference.get:
inference_id: _all
- length: { endpoints: 0}
- length: { endpoints: 1}
- match: { endpoints.0.inference_id: ".default-elser-2" }

- do:
inference.get:
inference_id: ""
- length: { endpoints: 0}
- length: { endpoints: 1}
- match: { endpoints.0.inference_id: ".default-elser-2" }

0 comments on commit ec9e8fc

Please sign in to comment.