On Thu, 7 Apr 2022 at 16:44, Steve Vaughan <em...@stevevaughan.me> wrote:
> I had planned on submitting some patches that replaced direct directory > references with uses of the JUnit rule TemporaryFolder. I noticed in > Confluence under "How to Contribute" that it has the recommendation: > > "By default, do not let tests write any temporary files to /tmp. Instead, > the tests should write to the location specified by the test.build.data > system property". > > > 1. This is an external dependency (both on the system property and > potentially the directory itself. “Unit tests should fail only if there’s > a bug in the system under test” > > 1. This isn’t reliable, since ZooKeeper has it’s own system property > build.test.data which is used during some tests > > 1. This means that any IDE running tests would have to set this system > property to safely run the tests > afraid so > > 1. Many of the tests include cleanup code (either before running or > after… it isn’t consistent) > after is good to clean up, needs to be good against test suites which fail in setup, otherwise the exception during setup is lost. for object stores, we want to delete all files to keep costs down doing it before means that if someone using an IDE who stopped the test run before that teardown cleanup happened, will find their next attempt fails. > > In the long run I'm looking for ways to make concurrently executing tests > safe. Automating the use of disposable directories that are automatically > cleaned up to avoid collisions between tests seems like a great answer. > if you look at the hadoop-aws module you can see how it splits up tests into a pool of forked processes, and has separate test subdirs for each fork. that goes under test.build.data, which is the absolute path to the target/ dir of the module hadoop-azure goes one step further and can run test cases of the same test suite class in parallel