Open hindsholm opened 7 years ago
Hi @hindsholm,
I've just tested here (just cloned master) and its all green, both via IDE and maven, here's my setup:
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-66-generic", arch: "amd64", family: "unix"
Anyone else experiencing this?
I also thought it was strange that nobody else had reported this, so it may be just me :) But on the other hand, I get the exact same error on both Linux and Windows and I also tried both OpenJDK and Oracle JDK, and I am running out of ideas of what to try...
That specific test is a concurrency error when running the ProjectAnalyzerTest
and some other. I've excluded parallel tests to not run via Maven, do you use multiple threads in you mvn
command?
Btw, we should also make the tests runnable in parallel (there is some static variable that needs to be modified which I can't remember right away...)
Thank you @sdaschner - your comment led me on the right track. I learned through some googling that since jaxrs-analyzer uses an older version (2.10) of surefire-plugin, you can ensure that tests are run sequentially by setting forkMode
like in:
mvn -DforkMode=always clean install
and the project builds just fine.
With a newer Surefire you could actually specify this behavior through an annotation as described in the official docs:
Since of Surefire 2.18, you can apply the JCIP annotation @net.jcip.annotations.NotThreadSafe on the Java class of JUnit test (test class, Suite, Parameterized, etc.) in order to execute it in single Thread instance.
I'll close the issue since it has now been solved.
@hindsholm @sdaschner I'd like to reopen this issue since it still occurs without the workaround (specifying -DforkMode=always). Can please one of you do that? (I don't have permission)
One fix would be to change the surefire configuration in the pom.xml to use that option. Another would be to adopt JCIP annotation. It is unfortunate that Surefire made it so hard to run tests sequentially. Parallel test running is a bad idea, as it introduces random variability (tests should always pass or always fail)...
surefire has a ThreadSafe annotation, the specifics escape me. i used @Ignore
I confirm, this test is still failing (java8, mvn 3.5.5)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.052 sec <<< FAILURE!
test(com.sebastian_daschner.jaxrs_analyzer.analysis.ProjectAnalyzerTest) Time elapsed: 1.051 sec <<< FAILURE!
org.junit.ComparisonFailure: expected:<[rest]> but was:<[]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.sebastian_daschner.jaxrs_analyzer.analysis.ProjectAnalyzerTest.test(ProjectAnalyzerTest.java:80)
config:
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Localdata\ProgramFiles\Java\jdk1.8.0_201\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
@sdaschner : I have created a PR to fix this concurrency issue with running the tests. I would be glad to support the project. That PR is #196
I am unable to build jaxrs-analyzer due to a failing test:
This is on a fresh clone from master.
My setup should be up to date:
The same test fails also on a similar setup on Windows 7.
Please let me know if I should provide more information.