Tests failing in IntelliJ

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Tests failing in IntelliJ

uris77
I have a weird case where my tests pass in the CLI but fail in Intellij. One test in particular is failing in IntelliJ. It is testing a handler and I get an error saying it couldn't find my ratpack.groovy file in PROJECT_HOME_DIR/ratpack.groovy.

This is the test: https://github.com/Spantree/esa-proxy/blob/develop/src/test/groovy/net/spantree/ratpack/elasticsearch/EsaProxyHandlerSpec.groovy.

You won't be able to run the spec because it needs a vagrant environment which is setup in another project. Sorry about that.

This is the stack trace:

ratpack.launch.LaunchException: Could not create handler via handler factory: ratpack.groovy.launch.GroovyScriptFileHandlerFactory
        at ratpack.server.RatpackServerBuilder.createHandler(RatpackServerBuilder.java:93)
        at ratpack.server.RatpackServerBuilder.createHandler(RatpackServerBuilder.java:85)
        at ratpack.server.RatpackServerBuilder.access$000(RatpackServerBuilder.java:42)
        at ratpack.server.RatpackServerBuilder$1.apply(RatpackServerBuilder.java:64)
        at ratpack.server.RatpackServerBuilder$1.apply(RatpackServerBuilder.java:61)
        at ratpack.server.internal.NettyRatpackServer.start(NettyRatpackServer.java:86)
        at ratpack.test.ServerBackedApplicationUnderTest.getAddress(ServerBackedApplicationUnderTest.java:43)
        at ratpack.groovy.test.internal.DefaultTestHttpClient.toAbsolute(DefaultTestHttpClient.java:261)
        at ratpack.groovy.test.internal.DefaultTestHttpClient.post(DefaultTestHttpClient.java:132)
        at net.spantree.ratpack.elasticsearch.EsaProxyHandlerSpec.post(EsaProxyHandlerSpec.groovy:27)
        at net.spantree.ratpack.elasticsearch.EsaProxyHandlerSpec.lists ten items by default(EsaProxyHandlerSpec.groovy:54)
Caused by: java.lang.RuntimeException: java.nio.file.NoSuchFileException: /HOME_DIR/esa-proxy/ratpack.groovy
        at ratpack.util.ExceptionUtils.uncheck(ExceptionUtils.java:43)
        at ratpack.reload.internal.ReloadableFileBackedFactory.<init>(ReloadableFileBackedFactory.java:77)
        at ratpack.reload.internal.ReloadableFileBackedFactory.<init>(ReloadableFileBackedFactory.java:64)
        at ratpack.groovy.internal.ScriptBackedApp.<init>(ScriptBackedApp.java:45)
        at ratpack.groovy.launch.GroovyScriptFileHandlerFactory.create(GroovyScriptFileHandlerFactory.java:72)
        at ratpack.server.RatpackServerBuilder.createHandler(RatpackServerBuilder.java:90)
        ... 10 more
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

danthegoodman
uris77 wrote
Caused by: java.lang.RuntimeException: java.nio.file.NoSuchFileException: /HOME_DIR/esa-proxy/ratpack.groovy
It looks like you may have a configuration error in Intellij, causing the PROJECT_HOME_DIR to get substituted with 'HOME_DIR' instead of something correct.

What does the XML configuration look like for the run configuration? You can find it in .idea/workspace.xml or .idea/runConfigs/<something>.xml, or another one of your intellij project files.
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

uris77
I added HOME_DIR there, but it is something like HOME/projectDir/. If my project resides in /home/user/esa-proxy, then the output is /home/user/esa-proxy/ratpack.groovy.
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

uris77
I got it resolved. There was a breaking change in the api.
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

uris77
I was wrong, there is something else broken. I think it could be IntelliJ. It runs fine in the CLI. Started getting this issues when I upgraded to Intellij 13.1.5. I can cope with only running the handler specs in the cli.
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

Luke Daley
Administrator
This could happen if Intellij doesn’t think that /ratpack is on the test class path, which it should be if you are using ./gradlew idea to get the project in.


On 23 October 2014 at 9:17:35 am, uris77 [via Ratpack Forum] ([hidden email]) wrote:

I was wrong, there is something else broken. I think it could be IntelliJ. It runs fine in the CLI. Started getting this issues when I upgraded to Intellij 13.1.5. I can cope with only running the handler specs in the cli.


If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack.io/Tests-failing-in-IntelliJ-tp734p738.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

uris77
Well, I'm convinced there is probably a bug in Ratpack now. The tests for the example books are failing when it tries to create the sample application for the tests. I get the same error on my project:

example-books(master) $
-> ./gradlew test
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy UP-TO-DATE
:prepareBaseDir UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test

ratpack.examples.book.BookApiSpec > list empty books FAILED
    java.lang.VerifyError at BookApiSpec.groovy:16

ratpack.examples.book.BookApiSpec > create book FAILED
    java.lang.VerifyError at BookApiSpec.groovy:16

ratpack.examples.book.BookFunctionalSpec > classMethod FAILED
    java.lang.VerifyError at BookFunctionalSpec.groovy:18

6 tests completed, 3 failed
:test FAILED
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

uris77
The test report says:

java.lang.VerifyError: Bad <init> method call from inside of a branch
Exception Details:
  Location:
    ratpack/examples/book/fixture/ExampleBooksApplicationUnderTest.<init>()V @33: invokespecial
  Reason:
    Error exists in the bytecode
  Bytecode:
    0x0000000: b800 164c b800 1c9a 0006 a700 1d2a 2b12
    0x0000010: 1d32 1202 b900 2302 0012 25b8 002b c000
    0x0000020: 25b7 002e a700 0a2a b800 32b7 002e 2ab6
    0x0000030: 0036 4d2c 2a5f b500 382c 57b1          
  Stackmap Table:
    append_frame(@13,Object[#60])
    same_frame(@39)
    full_frame(@46,{Object[#2],Object[#60]},{})

        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2658)
        at java.lang.Class.getDeclaredConstructors(Class.java:2007)
        at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
        at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
        at ratpack.examples.book.BookApiSpec.$spock_initializeFields(BookApiSpec.groovy:16)


I'm using java 1.8.0_20-b26
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

Marcin Erdmann
You need to use 1.8.0_25, this JDK bug you're seeing was fixed in that update.
Reply | Threaded
Open this post in threaded view
|

Re: Tests failing in IntelliJ

uris77
Nice, that fixed it. Thank you.