forked from opensearch-project/k-NN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKNNFeatureFlagsTests.java
34 lines (27 loc) · 1.19 KB
/
KNNFeatureFlagsTests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
package org.opensearch.knn.common.featureflags;
import org.mockito.Mock;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.knn.KNNTestCase;
import org.opensearch.knn.index.KNNSettings;
import static org.mockito.Mockito.when;
import static org.opensearch.knn.common.featureflags.KNNFeatureFlags.KNN_FORCE_EVICT_CACHE_ENABLED_SETTING;
import static org.opensearch.knn.common.featureflags.KNNFeatureFlags.isForceEvictCacheEnabled;
public class KNNFeatureFlagsTests extends KNNTestCase {
@Mock
ClusterSettings clusterSettings;
public void setUp() throws Exception {
super.setUp();
when(clusterService.getClusterSettings()).thenReturn(clusterSettings);
KNNSettings.state().setClusterService(clusterService);
}
public void testIsForceEvictCacheEnabled() throws Exception {
when(clusterSettings.get(KNN_FORCE_EVICT_CACHE_ENABLED_SETTING)).thenReturn(false);
assertFalse(isForceEvictCacheEnabled());
when(clusterSettings.get(KNN_FORCE_EVICT_CACHE_ENABLED_SETTING)).thenReturn(true);
assertTrue(isForceEvictCacheEnabled());
}
}