mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-20 13:27:00 +08:00
Rather than doing manual book keeping to plan the number of tests to run in each TAP suite, conclude each run with done_testing() summing up the the number of tests that ran. This removes the need for maintaning and updating the plan count at the expense of an accurate count of remaining during the test suite runtime. This patch has been discussed a number of times, often in the context of other patches which updates tests, so a larger number of discussions can be found in the archives. Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/DD399313-3D56-4666-8079-88949DAC870F@yesql.se
39 lines
1.2 KiB
Perl
39 lines
1.2 KiB
Perl
|
|
# Copyright (c) 2021-2022, PostgreSQL Global Development Group
|
|
|
|
# Single-node test: value can be set, and is still present after recovery
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use PostgreSQL::Test::Utils;
|
|
use Test::More;
|
|
use PostgreSQL::Test::Cluster;
|
|
|
|
my $node = PostgreSQL::Test::Cluster->new('foxtrot');
|
|
$node->init;
|
|
$node->append_conf('postgresql.conf', 'track_commit_timestamp = on');
|
|
$node->start;
|
|
|
|
# Create a table, compare "now()" to the commit TS of its xmin
|
|
$node->safe_psql('postgres',
|
|
'create table t as select now from (select now(), pg_sleep(1)) f');
|
|
my $true = $node->safe_psql('postgres',
|
|
'select t.now - ts.* < \'1s\' from t, pg_class c, pg_xact_commit_timestamp(c.xmin) ts where relname = \'t\''
|
|
);
|
|
is($true, 't', 'commit TS is set');
|
|
my $ts = $node->safe_psql('postgres',
|
|
'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\''
|
|
);
|
|
|
|
# Verify that we read the same TS after crash recovery
|
|
$node->stop('immediate');
|
|
$node->start;
|
|
|
|
my $recovered_ts = $node->safe_psql('postgres',
|
|
'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\''
|
|
);
|
|
is($recovered_ts, $ts, 'commit TS remains after crash recovery');
|
|
|
|
done_testing();
|