Skip to content

Arch Forum 2023-08-31

Participants: JD, Liangxiong, Shakib, Victor, Zak

Agenda

  • Current transactions issue
  • InMemory Servicebus and Integration Testing

Notes

Current transactions issue: As a first point of the day, Victor and Shakib described the ongoing issue with Transaction service and singleton message bus, which because of TransactionCallbackMessageHandler in Transaction service not being thread safe created a huge mess of half-completed transactions.

InMemory Servicebus and Integration Testing: The second and main point, everything about our integration testing and the Service bus.

During the summer, integration testing in Wallet and SalesTool were changed to mock away service bus, and at the same time only test one service or handler at a time. That is, instantiate the message handler, and then "manually" wire it up with inputs and outputs.

There are some benefits of this, notably
- Fast test execution since everything happens synchronous and there's no need for waits (e.g. the wait for a service to publish message and handler to get and process it).
- Cleaner test implementation, since there's no need for the waits, and it is also possible to (when suitable) reduce the setup needed for a test and have smaller separate tests.

We could also note some difficulties:
- It is important to test the integration between parts of an area.
- Having the tests on a higher level make it easier to match the test to the business requirements, resulting in better, more useful tests. If a, b and c should happen when an API is called, it's easier to reason about it as a single test, even if the actual logic is split by a http-service and message handler.

Some of the differences can be overcome, when Wallet were updated to this new way, the actual tests stayed the same, only their implementation changed. So, if previously a API call resulted in an event which ended up in a handler in a specific test, this could still be emulated in the "new way", by manually in the test instancing both service and event handler, and binding them together.

No real conclusion were reached, except that it does indeed look promising, and we should look closer at other areas which has slow/long running integration tests to see how / if it can work there. But more alignment is needed.