Skip to content

Commit

Permalink
Add more unit tests on Update model API
Browse files Browse the repository at this point in the history
Signed-off-by: Sicheng Song <[email protected]>
  • Loading branch information
b4sjoo committed Sep 23, 2023
1 parent 452bef8 commit 032579b
Show file tree
Hide file tree
Showing 3 changed files with 455 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ protected void doExecute(Task task, ActionRequest request, ActionListener<Update
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser);
if (r.getSource() != null && r.getSource().get(ALGORITHM_FIELD) != null) {
algorithmName = r.getSource().get(ALGORITHM_FIELD).toString();
}
} else
throw new RuntimeException("FUNCTION_NAME_FIELD not found for this model, model ID " + modelId);
MLModel mlModel = MLModel.parse(parser, algorithmName);
modelAccessControlHelper
.validateModelGroupAccess(user, mlModel.getModelGroupId(), client, ActionListener.wrap(hasPermission -> {
Expand All @@ -119,7 +120,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener<Update
actionListener
.onFailure(
new MLValidationException(
"User doesn't have privilege to perform this operation on this model, model ID" + modelId
"User doesn't have privilege to perform this operation on this model, model ID " + modelId
)
);
}
Expand Down Expand Up @@ -215,7 +216,7 @@ private void updateRemoteOrTextEmbeddingModel(
actionListener
.onFailure(
new MLValidationException(
"User doesn't have privilege to perform this operation on this function category"
"User doesn't have privilege to perform this operation on this function category: "
+ mlModel.getAlgorithm().toString()
)
);
Expand Down
Loading

0 comments on commit 032579b

Please sign in to comment.