From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Writing new unit tests with PostgresNode |
Date: | 2016-02-22 10:54:10 |
Message-ID: | CAMsr+YFH7ZDYL6TUo-Wtykw6V5VojYNU+5EHkcDMEOU4Ar=Smg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 22 February 2016 at 15:41, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> >> > Sound about right? I can tidy that up a bit and turn it into a README
> >> > and
> >> > add a reference to that to the public tap docs to tell users where to
> go
> >> > if
> >> > they want to write more tests.
> >>
> >> Yes, please.
> >
> > Will do that now.
>
> This is definitely independent from the efforts of the other patches.
>
Done.
I got a bit carried away and added:
- src/test/perl/README
- src/test/README
- src/test/modules/README
- POD for src/test/perl/PostgresNode.pm
- $node->info() function (that just returns what dump_info() printed, but
as a string
- $node->backup(...) support for passing -R to pg_basebackup
- $node->backup(...) support for passing -X stream to pg_basebackup
- src/test/example_suite/ with some simple demo tests
I found that I was writing documentation for how to write tests that'd
bitrot quickly and landed up writing a demo/sample test that can be run as
part of 'make check' with --enable-tap-tests instead. Hopefully it's not
overkill.
LMK if you think it's too much and I can trim out what's unwanted.
In the process I noticed a few helpers I think should be added to
PostgresNode. I haven't added them since I didn't want this to turn into a
big patch when it was meant to just be 'add a README', but the main things
are:
- promote (you've done this)
- Facilities to make it easier to set a master up as replication-enabled
(your patch does this, but it should use wal_level = 'logical' by default
IMO; also I think setting autovacuum=off is very wrong and will mask
problems)
- wait_for_recovery_lsn($lsn) to wait until a hot standby passes a given LSN
- wait_for_replication_lsn($lsn, $col, $appname) - wait until standby with
name $appname (or any standby, if unspecified) passes $lsn for $col, where
$col can be 'sent', 'write', 'flush' or 'replay'
> > Not committed yet, I see. That's
> https://commitfest.postgresql.org/9/438/
> > right?
>
> Yeah... That's life.
>
>
I'll comment separately on that thread.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-02-22 10:55:09 | Re: Writing new unit tests with PostgresNode |
Previous Message | Dave Cramer | 2016-02-22 10:26:47 | Re: JDBC behaviour |