This page aims at listing situations that were met which led to flaky tests. If you encounter flaky tests and do not understand why, you can have a look at the list.
If you met such situation and solved it, please document it there, so that others may benefit from your experience.
File improperly closed in Java code
In a test in version 19.04.0+dfsg-1 of libsis-jhdf5-java, calling the close() method of some object from a class implementing java.io.Closeable had been forgotten, so that system resources associated with it (namely, a file) were not released. Some other tests were run afterwards, and behaved in various ways:
- on some computers they failed because they expected no file to be open but found one;
- on some computers they passed, as they did not see unreleased system resources.
This seems to be due to the garbage collector behaving differently in those environments, sometimes releasing the resources at the end of the test that failed to do so, sometimes keeping them locked until the very end of the test session. We fixed the issue by invocating the close() method.