ops4j / org.ops4j.pax.exam

Pax Exam is an in-container testing framework for OSGi
https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/
Apache License 2.0
84 stars 100 forks source link

Tests fail when java.io.tmpdir does not exist [PAXEXAM-294] #426

Open ops4j-issues opened 13 years ago

ops4j-issues commented 13 years ago

Bram de Kruijff created PAXEXAM-294

In a maven build I typically set the java.io.tmpdir to $

{basedir}

/target/tmpdir. Upgrading to 2.3.0.M1 this no longer works as it fails on the fact that the dir does not exist. I'd like to try and create it instead of trying 100000 times to inevitably fail :smile:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.441 sec <<< FAILURE!
initializationError(org.amdatu.web.itest.tests.BenchmarkTest)  Time elapsed: 0.003 sec  <<< ERROR!
java.lang.IllegalStateException: Failed to create directory within 10000 attempts (tried 1319121719620-0 to 1319121719620-9999)
        at com.google.common.io.Files.createTempDir(Files.java:420)
        at org.ops4j.pax.exam.spi.DefaultExamSystem.createTemp(DefaultExamSystem.java:143)
        at org.ops4j.pax.exam.spi.DefaultExamSystem.<init>(DefaultExamSystem.java:117)
        at org.ops4j.pax.exam.spi.DefaultExamSystem.create(DefaultExamSystem.java:79)

Affects: 2.3.0.M1 Votes: 0, Watches: 0

ops4j-issues commented 13 years ago

Harald Wellmann commented

Well, if you change the system property java.io.tmpdir from the default to something else, then it's your own responsibility to ensure that 1) this path exists, 2) is a directory and 3) is writable.

I guess most Java applications will hiccup when you set java.io.tmpdir to Nirvana...

ops4j-issues commented 13 years ago

Bram de Kruijff commented

I'm agnostic so can't say if $

{basedir}

/target/tmpdir qualifies as Nirvana. It is however a valid path on my filesystem where the java process is authorized to mkdir. IMHO any program should check, try to recover and eventually fail gracefully.

It's no biggy but AFAIK pax exam did before because I only ran into this after the upgrade. That's why i reported it as a minor bug. Change it into on improvement if you like :smile:

ops4j-issues commented 13 years ago

Harald Wellmann commented

Well, my assumption is that $

{basedir}

/target/tmpdir does not exist when you run mvn clean install, unless you have some action in your build before Surefire and Exam are running which creates it. Could you please check?

And I'm not aware of any changes between 2.2.0 and 2.3.0.M1 in that area - which of course doesn't mean that there aren't any :wink: