Migration batch not processing when running @SpringBootTest

We migrate process instances on startup. We executeAsync, which starts a batch. We wait for the batch to complete (poll it). This works fine in normal operation (running using spring boot app with process application), however, when we run our tests (using @SpringBootTest) if a migration batch is created, the batch does not progress at all.

Does someone have some insight as to why this is? Is there some camunda feature that is not enabled by default when running @SpringBootTest ?

Any suggestions welcome.

FWIW, we identified the issue.

The problem is that the order of ProcessApplicationStartedEvent Listeners is different when running the tests. What ends up happening is that the workflow migration task is initiated before the JobExecutor is started. In normal operation, the JobExecutor is started before the migration.

There ends up being no way to influence the order of the listeners, so (for the tests) I had to reach inside spring, pull out thejob executor and start it manually (yuk) before the workflow migration task.

Hope this helps someone