Skip to content

AVRO-1970: Flaky test: TestInputBytes#172

Closed
gszadovszky wants to merge 2 commits intoapache:masterfrom
gszadovszky:AVRO-1970
Closed

AVRO-1970: Flaky test: TestInputBytes#172
gszadovszky wants to merge 2 commits intoapache:masterfrom
gszadovszky:AVRO-1970

Conversation

@gszadovszky
Copy link
Contributor

Root cause of flaky test (probability: 1/1000):
if length is0 at line 36 then random.nextInt(length) will fail with exception at line 43.

Copy link

@zivanfi zivanfi left a comment

Choose a reason for hiding this comment

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

LGTM

@rdblue
Copy link
Contributor

rdblue commented Dec 19, 2016

+1

@zivanfi
Copy link

zivanfi commented Dec 19, 2016

While the fix is correct and should be committed in my opinion, it has just occurred to me that there is a more fundamental problem in the background as well. I think we should use pseudo-random numbers in this test (i.e., initialize the random number generator with a fixed seed). It is not a fuzz test after all, but a unit test; it should be reproducible.

What do you think?

@rdblue
Copy link
Contributor

rdblue commented Dec 19, 2016

@Zicl, I mostly agree. The important thing when using Random in tests is that any error cases can be reproduced, so this should use a seed and either make it a constant, or log / print to stdout what it was. I don't think it matters which one, since both are pretty much fuzzing because we don't know what we're looking for.

@gszadovszky
Copy link
Contributor Author

Thanks for the hints. Added seed to make it deterministic.

iemejia referenced this pull request in iemejia/avro May 24, 2021
With the upgrade to Rust 1.49, the clippy lint `unnecessary_cast` was
[enhanced to work with integer and float literals][0]. There is one
instance of this in the codebase that is breaking the build.

This change removes the cast and fixes the clippy warning.

[0]: https://github.com/rust-lang/rust-clippy/blob/00586dfdcd10c37cb8b132c72ed0558304955042/CHANGELOG.md#enhancements-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants