From: Michael Paquier <michael@paquier.xyz>
To: r.zharkov@postgrespro.ru
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16914: Regression test of the worker_spi fails if USE_MODULE_DB environment variable is set.
Date: Thu, 4 Mar 2021 21:42:04 +0900
Message-ID: <YEDVnLVgr27T3ivk@paquier.xyz> (raw)
In-Reply-To: <16914-ca8dd84fef8db291@postgresql.org>
References: <16914-ca8dd84fef8db291@postgresql.org>
On Thu, Mar 04, 2021 at 07:43:11AM +0000, PG Bug reporting form wrote:
> I found a little problem with the test on the master branch:
>
> $ make -s -C src/test/modules/worker_spi check USE_MODULE_DB=TRUE
> ============== running regression test queries ==============
> test worker_spi ... FAILED 131652 ms
> ============== shutting down postmaster
Fun.
> Something like this fixes the problem:
One problem with this solution is that this is not portable. Instead
of generating dynamically the configuration file, here is funkier
solution as we know that worker_spi would restart if the database it
should connect to does not exist: let's use a completely different
database name, not expected by any other modules. Then, this database
gets created in worker_spi.sql, with a reconnection to it.
--
Michael
Attachments:worker-spi-test.patch (text/x-diff, 1.5K) downloaddiff --git a/src/test/modules/worker_spi/dynamic.conf b/src/test/modules/worker_spi/dynamic.confindex bfe015f664..2f480be1da 100644--- a/src/test/modules/worker_spi/dynamic.conf+++ b/src/test/modules/worker_spi/dynamic.conf@@ -1,2 +1,2 @@
shared_preload_libraries = worker_spi
-worker_spi.database = contrib_regression+worker_spi.database = regression_worker_spidiff --git a/src/test/modules/worker_spi/expected/worker_spi.out b/src/test/modules/worker_spi/expected/worker_spi.outindex dc0a79bf75..c54d5e6cf8 100644--- a/src/test/modules/worker_spi/expected/worker_spi.out+++ b/src/test/modules/worker_spi/expected/worker_spi.out@@ -1,3 +1,7 @@+-- Create the database specific to this test, and reconnect to it.+-- This matches with the configuration of dynamic.conf.+CREATE DATABASE regression_worker_spi;+\c regression_worker_spi
CREATE EXTENSION worker_spi;
SELECT worker_spi_launch(4) IS NOT NULL;
?column?
diff --git a/src/test/modules/worker_spi/sql/worker_spi.sql b/src/test/modules/worker_spi/sql/worker_spi.sqlindex 4683523b29..61a9781bc1 100644--- a/src/test/modules/worker_spi/sql/worker_spi.sql+++ b/src/test/modules/worker_spi/sql/worker_spi.sql@@ -1,3 +1,8 @@+-- Create the database specific to this test, and reconnect to it.+-- This matches with the configuration of dynamic.conf.+CREATE DATABASE regression_worker_spi;+\c regression_worker_spi+
CREATE EXTENSION worker_spi;
SELECT worker_spi_launch(4) IS NOT NULL;
-- wait until the worker completes its initialization
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, r.zharkov@postgrespro.ru
Subject: Re: BUG #16914: Regression test of the worker_spi fails if USE_MODULE_DB environment variable is set.
In-Reply-To: <YEDVnLVgr27T3ivk@paquier.xyz>
References: <16914-ca8dd84fef8db291@postgresql.org> <YEDVnLVgr27T3ivk@paquier.xyz>
* 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