-
Notifications
You must be signed in to change notification settings - Fork 25.3k
[BC Upgrage] Fix incorrect version parsing in tests #129243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
40cebb7
2d26e8e
4f8f8be
ccb80d5
250883c
b1f9e4d
a3cb702
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,14 +37,16 @@ public VectorSearchIT(@Name("upgradedNodes") int upgradedNodes) { | |
private static final String BBQ_INDEX_NAME = "bbq_vector_index"; | ||
private static final String FLAT_QUANTIZED_INDEX_NAME = "flat_quantized_vector_index"; | ||
private static final String FLAT_BBQ_INDEX_NAME = "flat_bbq_vector_index"; | ||
private static final String FLOAT_VECTOR_SEARCH_VERSION = "8.4.0"; | ||
private static final String BYTE_VECTOR_SEARCH_VERSION = "8.6.0"; | ||
private static final String QUANTIZED_VECTOR_SEARCH_VERSION = "8.12.1"; | ||
private static final String FLAT_QUANTIZED_VECTOR_SEARCH_VERSION = "8.13.0"; | ||
private static final String BBQ_VECTOR_SEARCH_VERSION = "8.18.0"; | ||
|
||
// TODO: replace these with proper test features | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to open a GitHub issue or Jira ticket describing how this would be done? I'm thinking of capturing your intent and knowledge here to benefit whoever ends up doing this work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH it is fine to leave these as-is, there is no value in retrofitting test features. I want it to be more of a warning for whoever will work on these tests in the future (and "nudge" them towards using a test feature) |
||
private static final String FLOAT_VECTOR_SEARCH_TEST_FEATURE = "gte_v8.4.0"; | ||
private static final String BYTE_VECTOR_SEARCH_TEST_FEATURE = "gte_v8.6.0"; | ||
private static final String QUANTIZED_VECTOR_SEARCH_TEST_FEATURE = "gte_v8.12.1"; | ||
private static final String FLAT_QUANTIZED_VECTOR_SEARCH_TEST_FEATURE = "gte_v8.13.0"; | ||
private static final String BBQ_VECTOR_SEARCH_TEST_FEATURE = "gte_v8.18.0"; | ||
|
||
public void testScriptByteVectorSearch() throws Exception { | ||
assumeTrue("byte vector search is not supported on this version", getOldClusterTestVersion().onOrAfter(BYTE_VECTOR_SEARCH_VERSION)); | ||
assumeTrue("byte vector search is not supported on this version", oldClusterHasFeature(BYTE_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
// create index and index 10 random floating point vectors | ||
String mapping = """ | ||
|
@@ -91,10 +93,7 @@ public void testScriptByteVectorSearch() throws Exception { | |
} | ||
|
||
public void testScriptVectorSearch() throws Exception { | ||
assumeTrue( | ||
"Float vector search is not supported on this version", | ||
getOldClusterTestVersion().onOrAfter(FLOAT_VECTOR_SEARCH_VERSION) | ||
); | ||
assumeTrue("Float vector search is not supported on this version", oldClusterHasFeature(FLOAT_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
// create index and index 10 random floating point vectors | ||
String mapping = """ | ||
|
@@ -140,10 +139,7 @@ public void testScriptVectorSearch() throws Exception { | |
} | ||
|
||
public void testFloatVectorSearch() throws Exception { | ||
assumeTrue( | ||
"Float vector search is not supported on this version", | ||
getOldClusterTestVersion().onOrAfter(FLOAT_VECTOR_SEARCH_VERSION) | ||
); | ||
assumeTrue("Float vector search is not supported on this version", oldClusterHasFeature(FLOAT_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
String mapping = """ | ||
{ | ||
|
@@ -215,7 +211,7 @@ public void testFloatVectorSearch() throws Exception { | |
} | ||
|
||
public void testByteVectorSearch() throws Exception { | ||
assumeTrue("Byte vector search is not supported on this version", getOldClusterTestVersion().onOrAfter(BYTE_VECTOR_SEARCH_VERSION)); | ||
assumeTrue("Byte vector search is not supported on this version", oldClusterHasFeature(BYTE_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
String mapping = """ | ||
{ | ||
|
@@ -288,10 +284,7 @@ public void testByteVectorSearch() throws Exception { | |
} | ||
|
||
public void testQuantizedVectorSearch() throws Exception { | ||
assumeTrue( | ||
"Quantized vector search is not supported on this version", | ||
getOldClusterTestVersion().onOrAfter(QUANTIZED_VECTOR_SEARCH_VERSION) | ||
); | ||
assumeTrue("Quantized vector search is not supported on this version", oldClusterHasFeature(QUANTIZED_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
String mapping = """ | ||
{ | ||
|
@@ -364,7 +357,7 @@ public void testQuantizedVectorSearch() throws Exception { | |
public void testFlatQuantizedVectorSearch() throws Exception { | ||
assumeTrue( | ||
"Quantized vector search is not supported on this version", | ||
getOldClusterTestVersion().onOrAfter(FLAT_QUANTIZED_VECTOR_SEARCH_VERSION) | ||
oldClusterHasFeature(FLAT_QUANTIZED_VECTOR_SEARCH_TEST_FEATURE) | ||
); | ||
if (isOldCluster()) { | ||
String mapping = """ | ||
|
@@ -434,10 +427,7 @@ public void testFlatQuantizedVectorSearch() throws Exception { | |
} | ||
|
||
public void testBBQVectorSearch() throws Exception { | ||
assumeTrue( | ||
"Quantized vector search is not supported on this version", | ||
getOldClusterTestVersion().onOrAfter(BBQ_VECTOR_SEARCH_VERSION) | ||
); | ||
assumeTrue("Quantized vector search is not supported on this version", oldClusterHasFeature(BBQ_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
String mapping = """ | ||
{ | ||
|
@@ -518,10 +508,7 @@ public void testBBQVectorSearch() throws Exception { | |
} | ||
|
||
public void testFlatBBQVectorSearch() throws Exception { | ||
assumeTrue( | ||
"Quantized vector search is not supported on this version", | ||
getOldClusterTestVersion().onOrAfter(BBQ_VECTOR_SEARCH_VERSION) | ||
); | ||
assumeTrue("Quantized vector search is not supported on this version", oldClusterHasFeature(BBQ_VECTOR_SEARCH_TEST_FEATURE)); | ||
if (isOldCluster()) { | ||
String mapping = """ | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
import java.io.Serializable; | ||
import java.io.UncheckedIOException; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.Properties; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
@@ -96,6 +97,23 @@ public static Version fromString(final String s, final Mode mode) { | |
return new Version(Integer.parseInt(major), Integer.parseInt(minor), revision == null ? 0 : Integer.parseInt(revision), qualifier); | ||
} | ||
|
||
public static Optional<Version> tryParse(final String s) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only ever used in |
||
Objects.requireNonNull(s); | ||
Matcher matcher = pattern.matcher(s); | ||
if (matcher.matches() == false) { | ||
return Optional.empty(); | ||
} | ||
|
||
String major = matcher.group(1); | ||
String minor = matcher.group(2); | ||
String revision = matcher.group(3); | ||
String qualifier = matcher.group(4); | ||
|
||
return Optional.of( | ||
new Version(Integer.parseInt(major), Integer.parseInt(minor), revision == null ? 0 : Integer.parseInt(revision), qualifier) | ||
); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getMajor() + "." + getMinor() + "." + getRevision(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.