JUnit java.nio.file.FileSystemAlreadyExistsException

Viewed 121

I am making a piece of software that runs a load test using the JUnit launcher. The problem is that I keep on encountering the following warning WARNING: Error scanning files for URI jar: ... with exception java.nio.file.FileSystemAlreadyExistsException emitted from the JUnit code base due to jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:102) at org.junit.platform.commons.util.CloseablePath.createForJarFileSystem(CloseablePath.java:57).

I am launching the same test across multiple threads. I believe the issue is caused by the .execute() method performing test discovery each time, causing a race condition inside the JUnit code.

I was wondering if there is there currently a way to perform test discovery once in JUnit and then use the same TestPlan to execute the test multiple times? If not is then is there a fix for this problem that allows me to invoke tests which are packaged in the .jar format (unzipping the test .jar is not feasible for my use case).

It seems to me that JUnit no longer supports executing the same test plan repeatedly https://github.com/junit-team/junit5/issues/2379 forcing inefficient test discovery to happen each time leading to the FileSystemAlreadyExistsException. The following class in JUnit may not be thread safe https://github.com/junit-team/junit5/blob/main/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java

Thanks!

0 Answers
Related