Skip to content

Commit 7c258eb

Browse files
committed
HSEARCH-5070 Add vector-search assumption to a test
1 parent 5e470af commit 7c258eb

File tree

1 file changed

+19
-0
lines changed
  • integrationtest/mapper/pojo-standalone-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/standalone/realbackend/mapping

1 file changed

+19
-0
lines changed

integrationtest/mapper/pojo-standalone-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/standalone/realbackend/mapping/VectorFieldIT.java

+19
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import static org.assertj.core.api.Assertions.assertThat;
1010
import static org.assertj.core.api.Assertions.assertThatThrownBy;
11+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
1112

1213
import java.lang.invoke.MethodHandles;
1314
import java.util.ArrayList;
@@ -42,6 +43,7 @@
4243
import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils;
4344
import org.hibernate.search.util.impl.integrationtest.mapper.pojo.standalone.StandalonePojoMappingSetupHelper;
4445

46+
import org.junit.jupiter.api.BeforeAll;
4547
import org.junit.jupiter.api.Test;
4648
import org.junit.jupiter.api.extension.RegisterExtension;
4749
import org.junit.jupiter.params.ParameterizedTest;
@@ -57,6 +59,14 @@ class VectorFieldIT {
5759
public StandalonePojoMappingSetupHelper setupHelper = StandalonePojoMappingSetupHelper.withSingleBackend(
5860
MethodHandles.lookup(), BackendConfigurations.simple() );
5961

62+
@BeforeAll
63+
static void beforeAll() {
64+
assumeTrue(
65+
isVectorSearchSupported(),
66+
"This test only makes sense if the backend supports vectors and vector search."
67+
);
68+
}
69+
6070
/*
6171
* While for the test of the max-allowed dimension it would be enough to index a single document and then search for it,
6272
* in this case we want to generate more than a few documents to see how the backends,
@@ -251,4 +261,13 @@ public Collection fromIndexedValue(float[] value, ValueBridgeFromIndexedValueCon
251261
return floats;
252262
}
253263
}
264+
265+
private static boolean isVectorSearchSupported() {
266+
return BackendConfiguration.isLucene()
267+
|| ElasticsearchTestDialect.isActualVersion(
268+
es -> !es.isLessThan( "8.12.0" ),
269+
os -> !os.isLessThan( "2.0.0" ),
270+
aoss -> true
271+
);
272+
}
254273
}

0 commit comments

Comments
 (0)