Skip to content

Commit 430e632

Browse files
authored
Improve tests stability around wait-until-pg-is-running. (#900)
In the GitHab Actions testing we see a lot of spurious errors around waiting for Postgres to be running after creating a monitor node. When diving in the logs, it seems like the configuration file for the monitor is still being written and there is a race condition when the client side command `pg_autoctl do pgsetup wait` tries to parse the pg_autoctl.cfg file and when the server-side `pg_autoctl run` writes it to disk. Here we just add a 2 seconds sleep before running the interactive command, to see if that theory holds. Later, we might want to have a retry loop over reading the configuration file in the `pg_autoctl do pgsetup ...` commands, to better handle this race condition.
1 parent d03138d commit 430e632

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/pgautofailover_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,10 @@ def run(self, env={}, name=None, host=None, port=None):
17271727
self.pg_autoctl = PGAutoCtl(self)
17281728
self.pg_autoctl.run(level="-v")
17291729

1730+
# avoid a race condition when trying to read the configuration file
1731+
# before it's ready.
1732+
time.sleep(2)
1733+
17301734
# when on the monitor we always want Postgres to be running to continue
17311735
self.wait_until_pg_is_running()
17321736

0 commit comments

Comments
 (0)