jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Parallel testing prevents checking for empty `FileSystemPool` mounts

Open gregw opened this issue 1 year ago • 2 comments

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!

gregw avatar Aug 05 '24 03:08 gregw

@janbartel

gregw avatar Aug 05 '24 03:08 gregw

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")

olamy avatar Aug 09 '24 06:08 olamy

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.

github-actions[bot] avatar Aug 22 '25 00:08 github-actions[bot]

This issue has been closed due to it having no activity.

github-actions[bot] avatar Oct 16 '25 00:10 github-actions[bot]