Skip to content

praefect: Fix flaky Postgres read/write check test

Patrick Steinhardt requested to merge pks-praefect-flaky-read-write-check into master

The test which verifies that the read/write check for Postgres fails as expected on a read-only database fails as expected is flaky. The root cause of this is the use of a timeout: we first lock the table that we're about to read in one transaction, then spawn the command which hangs while trying to read the database and then wait for the timeout to kick in. This doesn't really test what we want to test though: it only verifies that the command aborts with a timeout, but doesn't check against a real read-only database. Furthermore, the timeout leads to flakiness in our CI pipeline.

Fix the test to really test what we want to by creating a read-only user first, which is then used to connect to the database. Like this, inserting on the table will fail as expected and we don't need to use a timeout at all.

Closes #3945 (closed).

Merge request reports