3

Is it possible to share Micronaut context between tests? By using @MicronautTest annotation in Spock, context is created new for every test class.

This has negative side effects when combined with possible bug: https://github.com/micronaut-projects/micronaut-test/issues/615

We are using R2DBC thread pool. With context being renewed, and old one not cleared, DB quickly runs out of connections as each test class allocates additional connections.

So I am wondering if it is possible to just create context once for all test suite.

I have tried working with ContextBuilder, but when it is used then transactional = false is not working. As we are using r2dbc, this creates error that synchronous transactions cannot be used when reactional driver is applied.

saw303
  • 8,051
  • 7
  • 50
  • 90
piotrd
  • 31
  • 1

0 Answers0