Enable unit tests to use a real Postgres instance
The change removes in-memory implementation of the replication events queue and replaces all usages of it with the Postgres implementation.
It allows us to have more realistic tests scenarios and catch bugs earlier.
The change also fixes some small issues like awaiting for the background replication process to complete, removal of the unused code, fixes of the linter issues and refactoring.
Closes: #2636 (closed)
Edited by Pavlo Strokov