Skip to content

Commit

Permalink
Disable warning checks in k-NN test case (#1442) (#1471) (#1472)
Browse files Browse the repository at this point in the history
* Disable warning checks in k-NN test case

Signed-off-by: Junqiu Lei <junqiu@amazon.com>
(cherry picked from commit 9e28957)

Co-authored-by: Junqiu Lei <junqiu@amazon.com>
(cherry picked from commit 29279dc)

Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
  • Loading branch information
opensearch-trigger-bot[bot] authored Feb 8, 2024
1 parent 16a5e89 commit e7a9192
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
7 changes: 7 additions & 0 deletions src/test/java/org/opensearch/knn/KNNTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
19 changes: 0 additions & 19 deletions src/test/java/org/opensearch/knn/index/KNNSettingsTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void testGetSettingValueFromConfig() {
.getSettingValue(KNNSettings.KNN_MEMORY_CIRCUIT_BREAKER_LIMIT)).getKb();
mockNode.close();
assertEquals(expectedKNNCircuitBreakerLimit, actualKNNCircuitBreakerLimit);
assertWarnings();
}

@SneakyThrows
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -133,7 +127,6 @@ public void testFilteredSearchAdvanceSetting_whenValuesProvidedByUsers_thenValid
mockNode.close();
assertEquals(userDefinedThreshold, filteredSearchThreshold);
assertEquals(userDefinedThresholdMinValue, filteredSearchThresholdMinValue);
assertWarnings();
}

@SneakyThrows
Expand All @@ -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
Expand All @@ -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<String, Object> configSettings) throws IOException {
Expand Down Expand Up @@ -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"
);
}
}

0 comments on commit e7a9192

Please sign in to comment.