This is backport for next-mr. The patch adds new test cases that cover replication heartbeat testing.