Skip to content

Commit e7a9192

Browse files
Disable warning checks in k-NN test case (#1442) (#1471) (#1472)
* Disable warning checks in k-NN test case Signed-off-by: Junqiu Lei <[email protected]> (cherry picked from commit 9e28957) Co-authored-by: Junqiu Lei <[email protected]> (cherry picked from commit 29279dc) Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
1 parent 16a5e89 commit e7a9192

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

Diff for: src/test/java/org/opensearch/knn/KNNTestCase.java

+7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ public void tearDown() throws Exception {
5353
openMocks.close();
5454
}
5555

56+
@Override
57+
protected boolean enableWarningsCheck() {
58+
// Disable warnings check to avoid flaky tests, more details at:
59+
// https://github.com/opensearch-project/k-NN/issues/1392
60+
return false;
61+
}
62+
5663
public void resetState() {
5764
// Reset all of the counters
5865
for (KNNCounter knnCounter : KNNCounter.values()) {

Diff for: src/test/java/org/opensearch/knn/index/KNNSettingsTests.java

-19
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public void testGetSettingValueFromConfig() {
5151
.getSettingValue(KNNSettings.KNN_MEMORY_CIRCUIT_BREAKER_LIMIT)).getKb();
5252
mockNode.close();
5353
assertEquals(expectedKNNCircuitBreakerLimit, actualKNNCircuitBreakerLimit);
54-
assertWarnings();
5554
}
5655

5756
@SneakyThrows
@@ -69,10 +68,6 @@ public void testGetSettingValueDefault() {
6968
actualKNNCircuitBreakerLimit
7069

7170
);
72-
// set warning for deprecation of index.store.hybrid.mmap.extensions as expected temporarily, need to work on proper strategy of
73-
// switching to new setting in core
74-
// no-jdk distributions expected warning is a workaround for running tests locally
75-
assertWarnings();
7671
}
7772

7873
@SneakyThrows
@@ -87,7 +82,6 @@ public void testFilteredSearchAdvanceSetting_whenNoValuesProvidedByUsers_thenDef
8782
Integer filteredSearchThreshold = KNNSettings.getFilteredExactSearchThreshold(INDEX_NAME);
8883
mockNode.close();
8984
assertEquals(KNNSettings.ADVANCED_FILTERED_EXACT_SEARCH_THRESHOLD_DEFAULT_VALUE, filteredSearchThreshold);
90-
assertWarnings();
9185
}
9286

9387
@SneakyThrows
@@ -133,7 +127,6 @@ public void testFilteredSearchAdvanceSetting_whenValuesProvidedByUsers_thenValid
133127
mockNode.close();
134128
assertEquals(userDefinedThreshold, filteredSearchThreshold);
135129
assertEquals(userDefinedThresholdMinValue, filteredSearchThresholdMinValue);
136-
assertWarnings();
137130
}
138131

139132
@SneakyThrows
@@ -148,7 +141,6 @@ public void testGetEfSearch_whenNoValuesProvidedByUsers_thenDefaultSettingsUsed(
148141
Integer efSearchValue = KNNSettings.getEfSearchParam(INDEX_NAME);
149142
mockNode.close();
150143
assertEquals(KNNSettings.INDEX_KNN_DEFAULT_ALGO_PARAM_EF_SEARCH, efSearchValue);
151-
assertWarnings();
152144
}
153145

154146
@SneakyThrows
@@ -168,7 +160,6 @@ public void testGetEfSearch_whenEFSearchValueSetByUser_thenReturnValue() {
168160
int efSearchValue = KNNSettings.getEfSearchParam(INDEX_NAME);
169161
mockNode.close();
170162
assertEquals(userProvidedEfSearch, efSearchValue);
171-
assertWarnings();
172163
}
173164

174165
private Node createMockNode(Map<String, Object> configSettings) throws IOException {
@@ -199,14 +190,4 @@ private static Settings.Builder baseSettings() {
199190
.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType())
200191
.put(dataNode());
201192
}
202-
203-
private void assertWarnings() {
204-
// set warning for deprecation of index.store.hybrid.mmap.extensions as expected temporarily, need to work on proper strategy of
205-
// switching to new setting in core
206-
// no-jdk distributions expected warning is a workaround for running tests locally
207-
assertWarnings(
208-
"[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.",
209-
"no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release"
210-
);
211-
}
212193
}

0 commit comments

Comments
 (0)