Skip to content

Commit bade5ee

Browse files
authored
Fix TieredIndexIT, Scoped resource access change was missed (#1156)
#1089 Scoped Resource access changes were missed in the TieredIndex test causing them to fail. - Using CheckedCuVSResources.create() now - Skip TieredIndex tests if CuVS native support is unavailable Authors: - Puneet Ahuja (https://github.com/punAhuja) Approvers: - Mayya Sharipova (https://github.com/mayya-sharipova) - MithunR (https://github.com/mythrocks) URL: #1156
1 parent 1248cee commit bade5ee

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

java/cuvs-java/src/test/java/com/nvidia/cuvs/TieredIndexIT.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static org.junit.Assert.assertEquals;
1919
import static org.junit.Assert.assertFalse;
2020
import static org.junit.Assert.assertTrue;
21+
import static org.junit.Assume.assumeTrue;
2122

2223
import com.carrotsearch.randomizedtesting.RandomizedRunner;
2324
import java.lang.invoke.MethodHandles;
@@ -39,6 +40,7 @@ public class TieredIndexIT extends CuVSTestCase {
3940

4041
@Before
4142
public void setup() {
43+
assumeTrue("not supported on " + System.getProperty("os.name"), isLinuxAmd64());
4244
initializeRandom();
4345
log.debug("Random context initialized for test");
4446
}
@@ -67,7 +69,7 @@ public void testBasicOperations() throws Throwable {
6769
List<Map<Integer, Float>> expectedExtendedResults =
6870
Arrays.asList(Map.of(0, 0.02f, 1, 1.62f, 2, 7.22f), Map.of(2, 0.02f, 3, 2.42f, 1, 1.62f));
6971

70-
try (CuVSResources resources = CuVSResources.create()) {
72+
try (CuVSResources resources = CheckedCuVSResources.create()) {
7173
CagraIndexParams cagraParams =
7274
new CagraIndexParams.Builder().withGraphDegree(4).withIntermediateGraphDegree(8).build();
7375

@@ -114,7 +116,7 @@ public void testBasicOperations() throws Throwable {
114116

115117
@Test(expected = IllegalArgumentException.class)
116118
public void testErrorHandling() throws Throwable {
117-
try (CuVSResources resources = CuVSResources.create()) {
119+
try (CuVSResources resources = CheckedCuVSResources.create()) {
118120
CagraIndexParams cagraParams =
119121
new CagraIndexParams.Builder().withGraphDegree(4).withIntermediateGraphDegree(8).build();
120122

@@ -141,7 +143,7 @@ public void testDifferentKValues() throws Throwable {
141143

142144
float[][] queries = {{0.1f, 0.1f}};
143145

144-
try (CuVSResources resources = CuVSResources.create()) {
146+
try (CuVSResources resources = CheckedCuVSResources.create()) {
145147
CagraIndexParams cagraParams =
146148
new CagraIndexParams.Builder().withGraphDegree(4).withIntermediateGraphDegree(8).build();
147149

@@ -204,7 +206,7 @@ public void testPrefilter() throws Throwable {
204206
float[][] dataset = {{0.0f, 0.0f}, {1.0f, 1.0f}, {2.0f, 2.0f}, {3.0f, 3.0f}};
205207
float[][] queryVectors = {{0.1f, 0.1f}};
206208

207-
try (CuVSResources resources = CuVSResources.create()) {
209+
try (CuVSResources resources = CheckedCuVSResources.create()) {
208210
CagraIndexParams cagraParams =
209211
new CagraIndexParams.Builder().withGraphDegree(4).withIntermediateGraphDegree(8).build();
210212

0 commit comments

Comments
 (0)