Skip to content

Commit

Permalink
[Bugfix] Fix ICacheKeySerializerTests flakiness (#14564) (#14617)
Browse files Browse the repository at this point in the history
* Fix testInvalidInput flakiness



* Addressed andrross's comment



* rerun security check



---------



(cherry picked from commit f9512db)

Signed-off-by: Peter Alfonsi <[email protected]>
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 <[email protected]>
  • Loading branch information
3 people authored Jul 2, 2024
1 parent 22b73aa commit 7fb5550
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 7fb5550

Please sign in to comment.