Skip to content

Commit

Permalink
[Bugfix] Fix ICacheKeySerializerTests flakiness (opensearch-project#1…
Browse files Browse the repository at this point in the history
…4564) (opensearch-project#14617)

* Fix testInvalidInput flakiness

* Addressed andrross's comment

* rerun security check

---------

(cherry picked from commit f9512db)

Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: kkewwei <kkewwei@163.com>
  • Loading branch information
3 people authored and kkewwei committed Jul 24, 2024
1 parent f82931d commit 57d3c00
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ public void testInvalidInput() throws Exception {
ICacheKeySerializer<BytesReference> serializer = new ICacheKeySerializer<>(keySer);

Random rand = Randomness.get();
byte[] randomInput = new byte[1000];
rand.nextBytes(randomInput);

assertThrows(OpenSearchException.class, () -> serializer.deserialize(randomInput));
// The first thing the serializer reads is a VInt for the number of dimensions.
// This is an invalid input for StreamInput.readVInt(), so we are guaranteed to have an exception
assertThrows(OpenSearchException.class, () -> serializer.deserialize(new byte[] { -1, -1, -1, -1, -1 }));
}

public void testDimNumbers() throws Exception {
Expand Down

0 comments on commit 57d3c00

Please sign in to comment.