From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: worker_spi: Switch to TAP tests
Date: Thu, 27 Jul 2023 04:30:35 +0000
Message-ID: <E1qOse2-001XPW-5j@gemulon.postgresql.org> (raw)
worker_spi: Switch to TAP tests
This commit moves worker_spi to use TAP tests. sql/worker_spi.sql is
gone, replaced by an equivalent set of queries in a TAP script, without
worker_spi loaded in shared_preload_libraries:
- One query to launch a worker dynamically, relying now on "postgres" as
the default database to connect to.
- Two wait queries with poll_query_until(), one to wait for the worker
schema to be initialized and a second to wait for a tuple processed by
the worker.
- Server reload to accelerate the main loop of the spawned worker.
More coverage is added for workers registered when the library is loaded
with shared_preload_libraries, while on it, checking that these are
connecting to the database set in the GUC worker_spi.database.
A local run of these test is showing that TAP is slightly faster than
the original, while providing more coverage (3.7s vs 4.4s). There was
also some discussions about keeping the SQL tests, but this would
require initializing twice a cluster, increasing the runtime of the
tests up to 5.6s here.
These tests will be expanded more in an upcoming patch aimed at adding
support for custom wait events for the Extension class, still under
discussion, to check the new in-core APIs with and without a library set
in shared_preload_libraries.
Bharath has written the part where shared_preload_libraries is used,
while I have migrated the existing SQL tests to TAP.
Author: Bharath Rupireddy, Michael Paquier
Reviewed-by: Masahiro Ikeda
Discussion: https://postgr.es/m/CALj2ACWR9ncAiDF73unqdJF1dmsA2R0efGXX2624X+YVxcAVWg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/320c311fda912226bcb2e82b507b498161581dd2
Modified Files
--------------
src/test/modules/worker_spi/.gitignore | 2 -
src/test/modules/worker_spi/Makefile | 8 +--
src/test/modules/worker_spi/dynamic.conf | 2 -
.../modules/worker_spi/expected/worker_spi.out | 50 --------------
src/test/modules/worker_spi/meson.build | 9 +--
src/test/modules/worker_spi/sql/worker_spi.sql | 35 ----------
src/test/modules/worker_spi/t/001_worker_spi.pl | 80 ++++++++++++++++++++++
7 files changed, 84 insertions(+), 102 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: worker_spi: Switch to TAP tests
In-Reply-To: <E1qOse2-001XPW-5j@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox