Skip to content

Conversation

joshua-adams-1
Copy link
Contributor

@joshua-adams-1 joshua-adams-1 commented Sep 16, 2025

While writing #133558 I adopted an approach that utilised BytesStreamOutput and I wrote a unit test suite. Subsequent refactors have removed the need to use this class, but I still believe there is value in having the BytesStreamOutputTests suite.


Testing

I have ran this test suite through a 10000 times, and it all succeeds

@joshua-adams-1 joshua-adams-1 self-assigned this Sep 16, 2025
@joshua-adams-1 joshua-adams-1 added >non-issue :Distributed Coordination/Distributed A catch all label for anything in the Distributed Coordination area. Please avoid if you can. v9.2.0 and removed v9.2.0 labels Sep 16, 2025
@joshua-adams-1 joshua-adams-1 marked this pull request as ready for review September 16, 2025 11:03
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Sep 16, 2025
@joshua-adams-1 joshua-adams-1 added >test Issues or PRs that are addressing/adding tests and removed >non-issue labels Sep 24, 2025
Copy link
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple suggestions, but looks good 👍

byte[] byteArray = randomByteArrayOfLength(byteArrayLength);
stream.writeBytes(byteArray, 0, byteArrayLength);

int seekPosition = randomIntBetween(byteArrayLength, byteArrayLength + 100);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, a seek could be done to somewhere between 0 and byteArrayLength, and then a read can be done to show that it matches the byteArray? Same thing with skip below, though the seek would have to be further constrained to leave some room to test skip on the data set.

Would that be more realistic than setting the read position into space that hasn't been written yet? Or maybe test both?

@joshua-adams-1 joshua-adams-1 merged commit e1c65d4 into elastic:main Oct 2, 2025
35 checks passed
@joshua-adams-1 joshua-adams-1 deleted the bytes-stream-output-tests branch October 2, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Distributed A catch all label for anything in the Distributed Coordination area. Please avoid if you can. Team:Distributed Coordination Meta label for Distributed Coordination team >test Issues or PRs that are addressing/adding tests v9.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants