From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Jeremy Finzel <finzelj(at)gmail(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_regress restart cluster? |
Date: | 2019-09-07 02:52:43 |
Message-ID: | 20190907025243.GB31979@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 06, 2019 at 11:55:43AM -0500, Jeremy Finzel wrote:
> I am using the basic extension building infrastructure with sql and
> expected files, but what I want to test is changing a config setting and
> then restarting the cluster with shared_preload_libraries in place. Is
> there a canonical way to do this or does anyone have any examples of this?
> I appreciate it very much!
With an extension out of core using PGXS for compilation, "check" is
not support, only "installcheck" is. With "check", we use
REGRESS_OPTS with --temp-config to start up the cluster with a custom
configuration file. You can use that by copying your extension into
the core code tree. Also, depending on the extension type, you may be
able to test it without shared_preload_libraries. Most hooks, like
the password one, can be loaded in a session. If you use the shared
memory initialization hook that's of course not possible.
For an external extension, I think that you could just use TAP to test
any kind of system configurations you would like to test. One thing
to remember is that you need to set the environment variable
PG_REGRESS in the context of the test, one trick for example I have
used is that:
my $stdout = run_simple_command(['pg_config', '--libdir'],
"fetch library directory using pg_config");
print "LIBDIR path found as $stdout\n";
$ENV{PG_REGRESS} = "$stdout/pgxs/src/test/regress/pg_regress";
This proves to be enough to control the routines of PostgresNode.pm to
control a cluster, and even start your own pg_regress command with
the SQL-based tests part of your extension.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-09-07 02:58:14 | Re: Compiler warnings with MinGW |
Previous Message | Peter Geoghegan | 2019-09-07 01:26:04 | Re: amcheck verification for GiST |