Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests should not depend on random values nor deplete system entropy #58

Open
unzvfu opened this issue Aug 1, 2017 · 2 comments
Open

Comments

@unzvfu
Copy link

unzvfu commented Aug 1, 2017

Apparently some unit tests use system entropy. This is a bad idea because

  • system entropy is a very valuable resource that needs to be shared;
  • unit tests should not depend on truly random values; the prng should be seeded with a known value to ensure reproducibility of errors.
@unzvfu
Copy link
Author

unzvfu commented Aug 22, 2017

After more investigation it looks like there is no easy way to refactor the code base so that the random number generator can be parameterised (which it should be throughout, not just in the tests). This will be a big, public interface-breaking job.

@unzvfu unzvfu removed their assignment Aug 22, 2017
@wilko77
Copy link
Contributor

wilko77 commented Aug 22, 2017

another possible avenue:
Java lets you choose which CryptoProvider you want to use inside the JVM. We could implement our own Test Provider which just provides some not so secure random number generator. (more details: https://docs.oracle.com/javase/7/docs/technotes/guides/security/crypto/HowToImplAProvider.html#Steps)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants