azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

running test goal fails for maven

Open joostdenijs opened this issue 14 years ago • 2 comments

Moved from the private repository.

For the default Java project on jenkins, it fails to run the unit tests with the following error. [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ microsoft-windowsazure-api --- [INFO] Surefire report directory: e:\workspace\workspace\azure-sdk-for-java-WindowsAzure-dev-junit\microsoft-azure-api\target\surefire-reports The system cannot find the path specified. [ERROR] There are test failures.

Please refer to e:\workspace\workspace\azure-sdk-for-java-WindowsAzure-dev-junit\microsoft-azure-api\target\surefire-reports for the individual test results. [JENKINS] Recording test results [INFO]

joostdenijs avatar Jul 16 '12 21:07 joostdenijs

It turns out that the "cannot find the path" was due to a forking issue. In the POM, need to configure the surefire plugin to not fork:

 <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-surefire-plugin</artifactId>
   <version>2.12</version>
   <configuration>
     <forkMode>never</forkMode>
   </configuration>
 </plugin>

Fixing that exposed other issues:

  • Got "Could not initialize JceSecurity", which was because the java.home path needed to change from C:\Program Files\Java\jdk1.6.0_29\bin to C:\Program Files\Java\jdk1.6.0_29\jre.

  • The tests then failed because the env vars were not set in the CI server, so added an env var injection step for C:\java_env.properties

  • After enabling JceSecurity, there were still problems

    Jurisdiction policy files are not signed by trusted signers!

    This appears to be because they (the 1.6 versions) are signed with an expired certificate. I replaced the following files with those from my v7 install. (That should be OK because the JARs contain only text, no code).

    • c:\Program Files\Java\jdk1.6.0_29\jre\lib\security\local_policy.jar
    • c:\Program Files\Java\jdk1.6.0_29\jre\lib\security\US_export_policy.jar

I've updated the CI server and the Jenkins workflow. I'll need code review for the POM change, #138.

jcookems avatar Jul 20 '12 22:07 jcookems

Ah, @gcheng pointed out that forking should not have this sort of effect, which got me to thinking about what other side-effects forking could have. Turns out the env vars were not getting propagated to the forked process as (I) expected, so the real fix is to leave everything alone except the Jenkins config:

  • Got "Could not initialize JceSecurity", which was because the java.home path needed to change from C:\Program Files\Java\jdk1.6.0_29\bin to C:\Program Files\Java\jdk1.6.0_29\jre
  • In addition, need to explicitly override the default JAVA_HOME by adding this to the command line: -DJAVA_HOME="C:\Program Files\Java\jdk1.6.0_29\jre"
  • The tests then failed because the env vars were not set in the CI server, so added an env var injection step for C:\java_env.properties

jcookems avatar Jul 23 '12 23:07 jcookems