jetty.project
jetty.project copied to clipboard
Parallel testing prevents checking for empty `FileSystemPool` mounts
Jetty version(s) 12.1.0
Jetty Environment ee10 (and others)
Description
It is good practise to check that the FileSystemPool is left empty after tests like:
@AfterAll
public void tearDown()
{
assertThat(FileSystemPool.INSTANCE.mounts(), empty());
}
However, if tests are run in parallel, such checks often fail. For example if the above check is added to both WebAppClassLoaderTest and TestMetaData, then frequently the TestMetaData test will fail as it sees the mounts of the WebAppClassLoaderTest running in parallel.
We need a way to ensure that this check is done without other tests running!
@janbartel
It's just not thread-safe tests.
To be honest, I cannot see anything magic to be done except not using any more parallel tests, which means a very long build time, or marking the tests doing this check as @Isolated
Another solution would be to mark those classes with @ResourceLock(value = "FileSystemPool")
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to it having no activity.