saladinkzn / gretty

Advanced gradle plugin for running web-apps on jetty and tomcat.
MIT License
2 stars 2 forks source link

Gretty does not shutdown Jetty process after abnormally terminating #31

Open wcrowell opened 8 years ago

wcrowell commented 8 years ago

If Gretty abnormally terminates, then the container (Jetty) does not stop. This may be a bug in Gretty [https://github.com/akhikhl/gretty/issues/214] or Gradle [https://issues.gradle.org/browse/GRADLE-2263] which will be released in Gradle 3.0.

Workaround: This empty AppStopTask task makes Jetty shutdown if any of the tests fail.

task ('shutdownHook', type: AppStopTask) << { } project.afterEvaluate { project.tasks.test.finalizedBy shutdownHook } afterEvaluate makes sure the empty shutdownHook task runs when the test task exits from execution.

saladinkzn commented 8 years ago

Hello, I'll try to reproduce this.

wcrowell commented 8 years ago

If you clone the following project: https://github.com/wcrowell/cas-functional-tests

Comment out lines 53 and 54 as well as 58-60. Open up src/test/groovy/ValidateSpec.groovy. On line 12 change the call to getServiceTicket to some non-existent function:

def serviceTicket = getServiceTicket2("protected-web-app")

Run the tests again: gradle clean farmIntegrationTest

You should get an error like:

ValidateSpec > CAS 1.0 validation FAILED groovy.lang.MissingMethodException at ValidateSpec.groovy:12

Run ps -ef | grep jetty

You should see a jetty process running.

I am uncertain if any time should be spent on this since I think it is an issue with Gradle https://issues.gradle.org/browse/GRADLE-2263

saladinkzn commented 8 years ago

well, as far as I can remember gretty doesn't use jetty plugin