postgresql/src/test/postmaster
Heikki Linnakangas 5cbaa00592 Make postmaster 003_start_stop.pl test less flaky
The test is very sensitive to how backends start and exit, because it
tests dead-end backends which occur when all the connection slots are
in use. The test failed occasionally in the CI, when the backend that
was launched for the raw_connect_works() check lingered for a while,
and exited only later during the test. When it exited, it released a
connection slot, when the test expected all the slots to be in use at
that time.

The 002_connection_limits.pl test had a similar issue: if the backend
launched for safe_psql() in the test initialization lingers around, it
uses up a connection slot during the test, messing up the test's
connection counting. I haven't seen that in the CI, but when I added a
"sleep(1);" to proc_exit(), the test failed.

To make the tests more robust, restart the server to ensure that the
lingering backends doesn't interfere with the later test steps.

In the passing, fix a bogus test name.

Report and analysis by Jelte Fennema-Nio, Andres Freund, Thomas Munro.

Discussion: https://www.postgresql.org/message-id/CAGECzQSU2iGuocuP+fmu89hmBmR3tb-TNyYKjCcL2M_zTCkAFw@mail.gmail.com
Backpatch-through: 18
2025-12-17 16:23:13 +02:00
..
t Make postmaster 003_start_stop.pl test less flaky 2025-12-17 16:23:13 +02:00
.gitignore Silence assorted annoying test output. 2024-10-08 14:13:01 -04:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Test postmaster with program_options_handling_ok() et al. 2025-01-26 09:39:05 -08:00
README

src/test/postmaster/README

Regression tests for postmaster
===============================

This directory contains a test suite for postmaster's handling of
connections, connection limits, and startup/shutdown sequence.


Running the tests
=================

NOTE: You must have given the --enable-tap-tests argument to configure.

Run
    make check
or
    make installcheck
You can use "make installcheck" if you previously did "make install".
In that case, the code in the installation tree is tested.  With
"make check", a temporary installation tree is built from the current
sources and then tested.

Either way, this test initializes, starts, and stops a test Postgres
cluster.

See src/test/perl/README for more info about running these tests.