Reputation: 1418
I'm using the geb 0.9.2 plugin for grails 2.3.4
I want to run the functional tests separately from the service, on two separate hosts.
I have observed the following:
If I run the service on the same host, and execute:
grails test-app functional: -baseUrl=
http://localhost:8080/foo/
--non-interactive
then the tests are run against this already running service and pass.
If the service is not running, and I execute that same command, then a new service instance is started inside grails test-app
and the tests are run against that.
(This is unexpected to me)
If the service is running on a different host, at say
and I run:http://other:16060/foo/
grails test-app functional: -baseUrl=
http://other:16060/foo/
--non-interactive
... then a local service is started and the tests are run against that rather than against the specified remote service. Again this is unexpected to me.
I can't find any documentation explaining this behaviour.
Is it possible to run test-app
against a remotely running service?
(my recollection although I have not tested it recently is this behaviour was also the case with grails 2.2.2)
Upvotes: 11
Views: 1388
Reputation: 1418
This appears to be a grails bug (?feature).
Grails checks to see if the service is running by connecting to the service port.
If the service is not running, it starts a service.
The niggle is: The check to see if the service is running is always made against localhost/127.0.0.1 even if the baseUrl points to a different host.
I worked around it by starting a fake server on 127.0.0.1 using the unix nc tool. That is sufficient to make grails think the service is already running and not start up a new one. It then respects the baseUrl and tests the remote one.
Ugh.
Upvotes: 2
Reputation: 1660
Passing a baseUrl argument is how you run it against a remote server so you are doing everything right there. The only reason it wouldn't is if you also pass in a -inline or -war flag as well.
Try turning off forked execution in your tests and see if that solves the issue, it may be that the argument is not being passed to the forked JVM.
http://grails.org/doc/2.3.x/guide/commandLine.html#forkedMode
Upvotes: 0