Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.12] [Backport 2.x] Disable warning checks in k-NN test case #1472

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
);
}
}
Loading