forked from opensearch-project/k-NN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tejas Shah <[email protected]>
- Loading branch information
Showing
4 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/QueryANNIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.knn.bwc; | ||
|
||
import static org.opensearch.knn.common.KNNConstants.FAISS_NAME; | ||
|
||
public class QueryANNIT extends AbstractRestartUpgradeTestCase { | ||
|
||
private static final String TEST_FIELD = "test-field"; | ||
private static final int DIMENSIONS = 5; | ||
private static final int K = 5; | ||
private static final Integer EF_SEARCH = 10; | ||
private static final int NUM_DOCS = 10; | ||
private static final String ALGORITHM = "hnsw"; | ||
|
||
public void testQueryANN() throws Exception { | ||
if (isRunningAgainstOldCluster()) { | ||
createKnnIndex(testIndex, getKNNDefaultIndexSettings(), createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGORITHM, FAISS_NAME)); | ||
addKNNDocs(testIndex, TEST_FIELD, DIMENSIONS, 0, NUM_DOCS); | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K); | ||
} else { | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K); | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K, EF_SEARCH); | ||
deleteKNNIndex(testIndex); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/QueryANNIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.knn.bwc; | ||
|
||
import static org.opensearch.knn.TestUtils.NODES_BWC_CLUSTER; | ||
import static org.opensearch.knn.common.KNNConstants.FAISS_NAME; | ||
|
||
public class QueryANNIT extends AbstractRollingUpgradeTestCase { | ||
private static final String TEST_FIELD = "test-field"; | ||
private static final int DIMENSIONS = 5; | ||
private static final int K = 5; | ||
private static final Integer EF_SEARCH = 10; | ||
private static final int NUM_DOCS = 10; | ||
private static final String ALGORITHM = "hnsw"; | ||
|
||
public void testQueryANNIT() throws Exception { | ||
waitForClusterHealthGreen(NODES_BWC_CLUSTER); | ||
switch (getClusterType()) { | ||
case OLD: | ||
createKnnIndex( | ||
testIndex, | ||
getKNNDefaultIndexSettings(), | ||
createKnnIndexMapping(TEST_FIELD, DIMENSIONS, ALGORITHM, FAISS_NAME) | ||
); | ||
addKNNDocs(testIndex, TEST_FIELD, DIMENSIONS, 0, NUM_DOCS); | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K); | ||
break; | ||
case MIXED: | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K); | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K, EF_SEARCH); | ||
break; | ||
case UPGRADED: | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K); | ||
validateKNNSearch(testIndex, TEST_FIELD, DIMENSIONS, NUM_DOCS, K, EF_SEARCH); | ||
deleteKNNIndex(testIndex); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters