Skip to content

Commit

Permalink
fix failure UTs
Browse files Browse the repository at this point in the history
Signed-off-by: zane-neo <[email protected]>
  • Loading branch information
zane-neo committed Mar 13, 2024
1 parent 16df256 commit 2e2623b
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.opensearch.ml.common.model.TextEmbeddingModelConfig.FrameworkType.HUGGINGFACE_TRANSFORMERS;
import static org.opensearch.ml.common.model.TextEmbeddingModelConfig.FrameworkType.SENTENCE_TRANSFORMERS;
import static org.opensearch.ml.engine.algorithms.text_embedding.TextEmbeddingDenseModel.ML_ENGINE;
Expand All @@ -31,6 +32,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.opensearch.ResourceNotFoundException;
import org.opensearch.core.action.ActionListener;
import org.opensearch.ml.common.FunctionName;
Expand Down Expand Up @@ -601,13 +603,15 @@ public void predict_BeforeInitingModel() {

@Test
public void test_async_inference() {
exceptionRule.expect(IllegalStateException.class);
exceptionRule.expectMessage("Method is not implemented");
ArgumentCaptor<IllegalStateException> captor = ArgumentCaptor.forClass(IllegalStateException.class);
ActionListener actionListener = mock(ActionListener.class);
textEmbeddingDenseModel
.asyncPredict(
MLInput.builder().algorithm(FunctionName.TEXT_EMBEDDING).inputDataset(inputDataSet).build(),
mock(ActionListener.class)
actionListener
);
verify(actionListener).onFailure(captor.capture());
assert captor.getValue().getMessage().equals("Method is not implemented");
}

@After
Expand Down

0 comments on commit 2e2623b

Please sign in to comment.