Skip to content

Commit

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

* Fix testInvalidInput flakiness

Signed-off-by: Peter Alfonsi <[email protected]>

* Addressed andrross's comment

Signed-off-by: Peter Alfonsi <[email protected]>

* rerun security check

Signed-off-by: Peter Alfonsi <[email protected]>

---------

Signed-off-by: Peter Alfonsi <[email protected]>
Co-authored-by: Peter Alfonsi <[email protected]>
  • Loading branch information
2 people authored and harshavamsi committed Jul 12, 2024
1 parent 9e539ea commit 0619b2f
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 0619b2f

Please sign in to comment.