Testing problems in implementation in 1.6.4

Hello. I have updated lagom framework from 1.6.2 to 1.6.4 and had troubles with some test. After debugging I have noticed that the implementation of the service doesn’t start itself in tests if none of the service calls are invoked.

Let me give you an example. I have an api and its implementation. In the implementation when the service starts I subscribe to the topic and start receiving updates.
My tests in 1.6.2 version looked like this (and they worked) - the message is sent and it is processed by subscriber:

val producer: ProducerStub[Report] = server.application.producer
val saveReportProbe: TestProbe[Done] = server.application.probe
producer.send(report)
saveReportProbe.expectMessage(Done)

After updating to 1.6.4 tests started failing and one of the solution was to invoke some service call without side effects (like liveness check) and then test my logic:

client.check().invoke().flatMap { _ =>
producer.send(report)
saveReportProbe.expectMessage(Done)
}

Of course, this changes are easy to explain - if you want to test some separate components then test them without starting the whole service. But I haven’t found any comments in release note or in the documentation about this changes. Maybe, you should add it somewhere?

Thanks you in advance.

1 Like