Skip to content

Commit

Permalink
Fix flaky tests in KNNSettingsTests
Browse files Browse the repository at this point in the history
Signed-off-by: Junqiu Lei <[email protected]>
  • Loading branch information
junqiu-lei committed Feb 1, 2024
1 parent fe592f5 commit 987e4e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 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,7 @@ public void testGetSettingValueFromConfig() {
.getSettingValue(KNNSettings.KNN_MEMORY_CIRCUIT_BREAKER_LIMIT)).getKb();
mockNode.close();
assertEquals(expectedKNNCircuitBreakerLimit, actualKNNCircuitBreakerLimit);
assertWarnings();
allowedWarnings();
}

@SneakyThrows
Expand All @@ -72,7 +72,7 @@ public void testGetSettingValueDefault() {
// 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();
allowedWarnings();
}

@SneakyThrows
Expand All @@ -87,7 +87,7 @@ public void testFilteredSearchAdvanceSetting_whenNoValuesProvidedByUsers_thenDef
Integer filteredSearchThreshold = KNNSettings.getFilteredExactSearchThreshold(INDEX_NAME);
mockNode.close();
assertEquals(KNNSettings.ADVANCED_FILTERED_EXACT_SEARCH_THRESHOLD_DEFAULT_VALUE, filteredSearchThreshold);
assertWarnings();
allowedWarnings();
}

@SneakyThrows
Expand Down Expand Up @@ -129,7 +129,7 @@ public void testFilteredSearchAdvanceSetting_whenValuesProvidedByUsers_thenValid
mockNode.close();
assertEquals(userDefinedThreshold, filteredSearchThreshold);
assertEquals(userDefinedThresholdMinValue, filteredSearchThresholdMinValue);
assertWarnings();
allowedWarnings();
}

@SneakyThrows
Expand All @@ -144,7 +144,7 @@ public void testGetEfSearch_whenNoValuesProvidedByUsers_thenDefaultSettingsUsed(
Integer efSearchValue = KNNSettings.getEfSearchParam(INDEX_NAME);
mockNode.close();
assertEquals(KNNSettings.INDEX_KNN_DEFAULT_ALGO_PARAM_EF_SEARCH, efSearchValue);
assertWarnings();
allowedWarnings();
}

@SneakyThrows
Expand All @@ -164,7 +164,7 @@ public void testGetEfSearch_whenEFSearchValueSetByUser_thenReturnValue() {
int efSearchValue = KNNSettings.getEfSearchParam(INDEX_NAME);
mockNode.close();
assertEquals(userProvidedEfSearch, efSearchValue);
assertWarnings();
allowedWarnings();
}

private Node createMockNode(Map<String, Object> configSettings) throws IOException {
Expand Down Expand Up @@ -196,11 +196,11 @@ private static Settings.Builder baseSettings() {
.put(dataNode());
}

private void assertWarnings() {
private void allowedWarnings() {
// 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(
allowedWarnings(
"[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"
);
Expand Down

0 comments on commit 987e4e8

Please sign in to comment.