I also came across this! Pretty sure this is grails bug ... I sent jira and the patch .
The error is caused because the code in grails.test.spock.IntegrationSpec does not check interceptor.isTransactional() before calling interceptor.destroy()
def cleanup() { perMethodRequestEnvironmentInterceptor?.destroy() perMethodTransactionInterceptor?.destroy() //breaks :( } ... private GrailsTestTransactionInterceptor initTransaction() { def interceptor = new GrailsTestTransactionInterceptor(applicationContext) if (interceptor.isTransactional(this)) interceptor.init() //also need for destroy() interceptor }
My fix was to add this code:
def cleanup() { perMethodRequestEnvironmentInterceptor?.destroy() destroyTransaction(perMethodTransactionInterceptor) } ... private void destroyTransaction(GrailsTestTransactionInterceptor interceptor){ if (interceptor?.isTransactional(this)) interceptor.destroy() }
To get around this now, you can simply create your own com.myname.IntegrationSpec with the corrected code and extend it instead of grails.test.spock.IntegrationSpec. Not perfect ... but it works :)
source share