Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: AnnTian Shao <anntians@amazon.com>
  • Loading branch information
AnnTian Shao committed Feb 26, 2025
1 parent 8a1ac42 commit f267557
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.opensearch.knn.common.KNNConstants.ENCODER_FLAT;
import static org.opensearch.knn.common.KNNConstants.METHOD_ENCODER_PARAMETER;
import static org.opensearch.knn.common.KNNConstants.METHOD_HNSW;
import static org.opensearch.knn.common.KNNConstants.ENCODER_PARAMETER_PQ_M;

public class FaissMethodResolverTests extends KNNTestCase {

Expand Down Expand Up @@ -270,10 +271,14 @@ public void testResolveMethod_whenInvalid_thenThrow() {

);

Map<String, Object> parameters = Map.of("m", 3);

Map<String, Object> parameters = Map.of(
ENCODER_PARAMETER_PQ_M,
3,
METHOD_ENCODER_PARAMETER,
new MethodComponentContext("pq", Map.of())
);
MethodComponentContext methodComponentContext = new MethodComponentContext(METHOD_HNSW, parameters);
final KNNMethodContext knnMethodContext = new KNNMethodContext(KNNEngine.FAISS, SpaceType.DEFAULT, methodComponentContext);
final KNNMethodContext knnMethodContext = new KNNMethodContext(KNNEngine.FAISS, SpaceType.INNER_PRODUCT, methodComponentContext);

KNNMethodConfigContext knnMethodConfigContext = KNNMethodConfigContext.builder()
.vectorDataType(VectorDataType.FLOAT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testTrainModel_fail_notEnoughData() throws Exception {

// Create a training index and randomly ingest data into it
createBasicKnnIndex(trainingIndexName, trainingFieldName, dimension);
int trainingDataCount = 4;
int trainingDataCount = 1;
bulkIngestRandomVectors(trainingIndexName, trainingFieldName, trainingDataCount, dimension);

// Call the train API with this definition:
Expand Down

0 comments on commit f267557

Please sign in to comment.