From 084f94f6a84c85b43f6f3bc50ed3acb6cff86b97 Mon Sep 17 00:00:00 2001 From: John Mazanec Date: Wed, 4 Jan 2023 12:58:00 -0800 Subject: [PATCH] Update backwards compatibility versions (#702) Signed-off-by: John Mazanec --- ...backwards_compatibility_tests_workflow.yml | 4 +- .../opensearch/knn/bwc/LuceneFilteringIT.java | 86 ------------------- 2 files changed, 2 insertions(+), 88 deletions(-) delete mode 100644 qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/LuceneFilteringIT.java diff --git a/.github/workflows/backwards_compatibility_tests_workflow.yml b/.github/workflows/backwards_compatibility_tests_workflow.yml index d3675cd45..dc164d4d7 100644 --- a/.github/workflows/backwards_compatibility_tests_workflow.yml +++ b/.github/workflows/backwards_compatibility_tests_workflow.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: java: [ 11, 17 ] - bwc_version : [ "1.1.0", "1.2.4", "1.3.2", "2.0.0", "2.1.0", "2.2.0" ] + bwc_version : [ "1.1.0", "1.2.4", "1.3.7", "2.0.1", "2.1.0", "2.2.1", "2.3.0", "2.4.1" ] opensearch_version : [ "2.5.0-SNAPSHOT" ] name: k-NN Restart-Upgrade BWC Tests @@ -46,7 +46,7 @@ jobs: strategy: matrix: java: [ 11, 17 ] - bwc_version: [ "1.3.2", "2.0.0", "2.1.0", "2.2.0" ] + bwc_version: [ "1.3.7", "2.0.1", "2.1.0", "2.2.1", "2.3.0", "2.4.1" ] opensearch_version: [ "2.5.0-SNAPSHOT" ] name: k-NN Rolling-Upgrade BWC Tests diff --git a/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/LuceneFilteringIT.java b/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/LuceneFilteringIT.java deleted file mode 100644 index 3a7d0329d..000000000 --- a/qa/rolling-upgrade/src/test/java/org/opensearch/knn/bwc/LuceneFilteringIT.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.opensearch.knn.bwc; - -import org.hamcrest.MatcherAssert; -import org.opensearch.knn.TestUtils; -import org.opensearch.knn.index.query.KNNQueryBuilder; -import org.opensearch.index.query.QueryBuilders; -import org.opensearch.index.query.TermQueryBuilder; - -import org.opensearch.client.Request; -import org.opensearch.client.ResponseException; -import org.opensearch.common.Strings; -import org.opensearch.common.xcontent.ToXContent; -import org.opensearch.common.xcontent.XContentBuilder; -import org.opensearch.common.xcontent.XContentFactory; - -import java.io.IOException; - -import static org.hamcrest.CoreMatchers.anyOf; -import static org.hamcrest.CoreMatchers.containsString; -import static org.opensearch.knn.TestUtils.NODES_BWC_CLUSTER; -import static org.opensearch.knn.common.KNNConstants.LUCENE_NAME; -import static org.opensearch.knn.common.KNNConstants.METHOD_HNSW; - -/** - * Tests scenarios specific to filtering functionality in k-NN in case Lucene is set as an engine - */ -public class LuceneFilteringIT extends AbstractRollingUpgradeTestCase { - private static final String TEST_FIELD = "test-field"; - private static final int DIMENSIONS = 50; - private static final int K = 10; - private static final int NUM_DOCS = 100; - private static final TermQueryBuilder TERM_QUERY = QueryBuilders.termQuery("_id", "100"); - - public void testLuceneFiltering() throws Exception { - waitForClusterHealthGreen(NODES_BWC_CLUSTER); - float[] queryVector = TestUtils.getQueryVectors(1, DIMENSIONS, NUM_DOCS, true)[0]; - switch (getClusterType()) { - case OLD: - createKnnIndex( - testIndex, - getKNNDefaultIndexSettings(), - createKnnIndexMapping(TEST_FIELD, DIMENSIONS, METHOD_HNSW, LUCENE_NAME) - ); - bulkAddKnnDocs(testIndex, TEST_FIELD, TestUtils.getIndexVectors(NUM_DOCS, DIMENSIONS, true), NUM_DOCS); - validateSearchKNNIndexFailed(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, K, TERM_QUERY), K); - break; - case MIXED: - validateSearchKNNIndexFailed(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, K, TERM_QUERY), K); - break; - case UPGRADED: - searchKNNIndex(testIndex, new KNNQueryBuilder(TEST_FIELD, queryVector, K, TERM_QUERY), K); - deleteKNNIndex(testIndex); - break; - } - } - - private void validateSearchKNNIndexFailed(String index, KNNQueryBuilder knnQueryBuilder, int resultSize) throws IOException { - XContentBuilder builder = XContentFactory.jsonBuilder().startObject().startObject("query"); - knnQueryBuilder.doXContent(builder, ToXContent.EMPTY_PARAMS); - builder.endObject().endObject(); - - Request request = new Request("POST", "/" + index + "/_search"); - - request.addParameter("size", Integer.toString(resultSize)); - request.addParameter("explain", Boolean.toString(true)); - request.addParameter("search_type", "query_then_fetch"); - request.setJsonEntity(Strings.toString(builder)); - - Exception exception = expectThrows(ResponseException.class, () -> client().performRequest(request)); - // assert for two possible exception messages, fist one can come from current version in case serialized request is coming from - // lower version, - // second exception is vise versa, when lower version node receives request with filter field from higher version - MatcherAssert.assertThat( - exception.getMessage(), - anyOf( - containsString("filter field is supported from version"), - containsString("[knn] unknown token [START_OBJECT] after [filter]") - ) - ); - } -}