Open katoquro opened 3 years ago
Still here in 2.5.5 I can suggest using a workaround: different registration id for every test.... It looks like
@MicronautTest(application = TestingApplication)
@Property(name="micronaut.application.name", value = "ProjectControllerSpec")
class ProjectControllerSpec extends Specification {
@Client(id = 'ProjectControllerSpec', path = '/api/web/projects')
static interface ProjectControllerClient extends ProjectEndpoints {}
@Inject ProjectControllerClient client
//...
}
Some time ago we faced with unstable tests. They become very often on CI and rare at dev machine. I found out that there is an issue with registration and deregistration in consul (I'll prove logs and traces bellow)
Task List
Steps to Reproduce
@Client(id = 'service-id', path = '/api/endpoint-path')
@MicronautTest
(in my case it's validation configuration test)@MicronautTest
Expected Behaviour
in the first test app register and then deregister correctly and the second test goes OK
Actual Behaviour
first test call deregister earlier than register and make consul inconsistent the second fails with stacktrace
What happens in consul
You can see log
appears earlier than registration bellow. We use random port configuration so every test uses it's own port
my fast test looks like
and this is it's log
You can see that timing is odd in consul, looks like registering takes more time and deregistering ignores fails and during heartbeat (I think) all next tests can see wrong registration
How I create my clients inside test
Environment Information
Example Application