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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With