From e7a919221ef37db1e68ae0189c222f282f47217a Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:16:30 -0800 Subject: [PATCH] Disable warning checks in k-NN test case (#1442) (#1471) (#1472) * Disable warning checks in k-NN test case Signed-off-by: Junqiu Lei (cherry picked from commit 9e28957013cbecf98f219927938aa69ef5d49152) Co-authored-by: Junqiu Lei (cherry picked from commit 29279dc067c49b8d64216cc678ec246d61834c3e) Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> --- .../java/org/opensearch/knn/KNNTestCase.java | 7 +++++++ .../knn/index/KNNSettingsTests.java | 19 ------------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/test/java/org/opensearch/knn/KNNTestCase.java b/src/test/java/org/opensearch/knn/KNNTestCase.java index 3f20981bd..565feb398 100644 --- a/src/test/java/org/opensearch/knn/KNNTestCase.java +++ b/src/test/java/org/opensearch/knn/KNNTestCase.java @@ -53,6 +53,13 @@ public void tearDown() throws Exception { openMocks.close(); } + @Override + protected boolean enableWarningsCheck() { + // Disable warnings check to avoid flaky tests, more details at: + // https://github.com/opensearch-project/k-NN/issues/1392 + return false; + } + public void resetState() { // Reset all of the counters for (KNNCounter knnCounter : KNNCounter.values()) { diff --git a/src/test/java/org/opensearch/knn/index/KNNSettingsTests.java b/src/test/java/org/opensearch/knn/index/KNNSettingsTests.java index 4292b1a4f..6b4751afa 100644 --- a/src/test/java/org/opensearch/knn/index/KNNSettingsTests.java +++ b/src/test/java/org/opensearch/knn/index/KNNSettingsTests.java @@ -51,7 +51,6 @@ public void testGetSettingValueFromConfig() { .getSettingValue(KNNSettings.KNN_MEMORY_CIRCUIT_BREAKER_LIMIT)).getKb(); mockNode.close(); assertEquals(expectedKNNCircuitBreakerLimit, actualKNNCircuitBreakerLimit); - assertWarnings(); } @SneakyThrows @@ -69,10 +68,6 @@ public void testGetSettingValueDefault() { actualKNNCircuitBreakerLimit ); - // set warning for deprecation of index.store.hybrid.mmap.extensions as expected temporarily, need to work on proper strategy of - // switching to new setting in core - // no-jdk distributions expected warning is a workaround for running tests locally - assertWarnings(); } @SneakyThrows @@ -87,7 +82,6 @@ public void testFilteredSearchAdvanceSetting_whenNoValuesProvidedByUsers_thenDef Integer filteredSearchThreshold = KNNSettings.getFilteredExactSearchThreshold(INDEX_NAME); mockNode.close(); assertEquals(KNNSettings.ADVANCED_FILTERED_EXACT_SEARCH_THRESHOLD_DEFAULT_VALUE, filteredSearchThreshold); - assertWarnings(); } @SneakyThrows @@ -133,7 +127,6 @@ public void testFilteredSearchAdvanceSetting_whenValuesProvidedByUsers_thenValid mockNode.close(); assertEquals(userDefinedThreshold, filteredSearchThreshold); assertEquals(userDefinedThresholdMinValue, filteredSearchThresholdMinValue); - assertWarnings(); } @SneakyThrows @@ -148,7 +141,6 @@ public void testGetEfSearch_whenNoValuesProvidedByUsers_thenDefaultSettingsUsed( Integer efSearchValue = KNNSettings.getEfSearchParam(INDEX_NAME); mockNode.close(); assertEquals(KNNSettings.INDEX_KNN_DEFAULT_ALGO_PARAM_EF_SEARCH, efSearchValue); - assertWarnings(); } @SneakyThrows @@ -168,7 +160,6 @@ public void testGetEfSearch_whenEFSearchValueSetByUser_thenReturnValue() { int efSearchValue = KNNSettings.getEfSearchParam(INDEX_NAME); mockNode.close(); assertEquals(userProvidedEfSearch, efSearchValue); - assertWarnings(); } private Node createMockNode(Map configSettings) throws IOException { @@ -199,14 +190,4 @@ private static Settings.Builder baseSettings() { .put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType()) .put(dataNode()); } - - private void assertWarnings() { - // set warning for deprecation of index.store.hybrid.mmap.extensions as expected temporarily, need to work on proper strategy of - // switching to new setting in core - // no-jdk distributions expected warning is a workaround for running tests locally - assertWarnings( - "[index.store.hybrid.mmap.extensions] setting was deprecated in OpenSearch and will be removed in a future release! See the breaking changes documentation for the next major version.", - "no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" - ); - } }