-
Notifications
You must be signed in to change notification settings - Fork 127
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
Update tests for backwards codecs #710
Update tests for backwards codecs #710
Conversation
Updates tests for backwards codecs to prevent backwards codecs from writing with a read only codec. Signed-off-by: John Mazanec <[email protected]>
.build(); | ||
|
||
testKnnVectorIndex(knnCodecProvider, perFieldKnnVectorsFormatProvider); | ||
assertTrue(codec.knnVectorsFormat() instanceof KNN940PerFieldKnnVectorsFormat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use class of format class the is defined in the version enum, something like:
assertThat(codec.knnVectorsFormat(), isA(V_9_4_0.getPerFieldKnnVectorsFormat().getClass()));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that assertThat is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.hamcrest.MatcherAssert.assertThat should be ok
.knnVectorsFormat(V_9_4_0.getPerFieldKnnVectorsFormat()) | ||
.build(); | ||
|
||
assertTrue(codec.knnVectorsFormat() instanceof KNN940PerFieldKnnVectorsFormat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
Codecov Report
@@ Coverage Diff @@
## main #710 +/- ##
============================================
+ Coverage 84.37% 84.39% +0.02%
- Complexity 1066 1067 +1
============================================
Files 151 151
Lines 4345 4345
Branches 389 389
============================================
+ Hits 3666 3667 +1
+ Misses 499 498 -1
Partials 180 180
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: John Mazanec <[email protected]>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-710-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8b168311d345228c30408bbb8078943b13477823
# Push it to GitHub
git push --set-upstream origin backport/backport-710-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
Updates tests for backwards codecs to prevent backwards codecs from writing with a read only codec. Signed-off-by: John Mazanec <[email protected]>
* Update lucene94 package Signed-off-by: Naveen Tatikonda <[email protected]> * Add Lucene 9.5 codec and make it new default (#700) * Add Lucene 9.5 codec and make it new default Signed-off-by: Martin Gaievski <[email protected]> * Update tests for backwards codecs (#710) Updates tests for backwards codecs to prevent backwards codecs from writing with a read only codec. Signed-off-by: John Mazanec <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> Signed-off-by: Martin Gaievski <[email protected]> Signed-off-by: John Mazanec <[email protected]> Co-authored-by: Martin Gaievski <[email protected]> Co-authored-by: John Mazanec <[email protected]>
Description
Updates tests for backwards codecs to prevent backwards codecs from writing with a read only codec.
Right now, testKnnVectorIndex requires that the Hnsw Lucene Format have the capability to write. For backwards codecs, however, they are not able to write (see https://github.com/apache/lucene/blob/main/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene94/Lucene94HnswVectorsFormat.java#L150).
To resolve this, we are removing the "testKnnVectorIndex" from backwards compatibility tests. For reading/writing backwards compatibility testing, we will rely on Lucene, where tests can be found in https://github.com/apache/lucene/tree/main/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene94.
It adds a test that checks that our custom format is correctly overriden.
Issues Resolved
https://build.ci.opensearch.org/job/distribution-build-opensearch/6804/
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.