AVRO-1970: Flaky test: TestInputBytes#172
Conversation
422e9c2 to
c758bf3
Compare
|
+1 |
|
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? |
|
@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. |
|
Thanks for the hints. Added seed to make it deterministic. |
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
Root cause of flaky test (probability: 1/1000):
if
lengthis0at line 36 thenrandom.nextInt(length)will fail with exception at line 43.