Skip to content

Fix TransactionManager still running after tests

Sami Hiltunen requested to merge smh-fix-tm-test-flake into master

TransactionManager's test setup had a race which allowed for the Run goroutine to be running still after the tests ended. This could happen as checkManagerError helper was not waiting for either the test transaction to receive an error or for the Run to return. It concluded that the manager was still running as soon as the test transaction was admitted. This is not the case as the manager checks its context after admitting a transaction. This commit fixes the unclear situation by waiting for either the manager's Run to really exit or for the test transaction to be rejected, confirming that the manager is stilll processing transactions. This should fix the flake that occurred when the Run goroutine was still running after the tests concluded.

Closes #4743 (closed)

I didn't manage to reproduce the flakiness but I found this by eyeing through the code. I've also added an extra assert to ensure the manager is actually stopped in stopManager which would tell use the test name where the manager didn't close if this should still occur.

Edited by Sami Hiltunen

Merge request reports