diff options
Diffstat (limited to 'src/test/modules/commit_ts/t/003_standby_2.pl')
-rw-r--r-- | src/test/modules/commit_ts/t/003_standby_2.pl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl index fadb6a237d9..138cc43dc2b 100644 --- a/src/test/modules/commit_ts/t/003_standby_2.pl +++ b/src/test/modules/commit_ts/t/003_standby_2.pl @@ -4,7 +4,7 @@ use strict; use warnings; use TestLib; -use Test::More tests => 2; +use Test::More tests => 4; use PostgresNode; my $bkplabel = 'backup'; @@ -24,23 +24,25 @@ $standby->start; for my $i (1 .. 10) { - $master->psql('postgres', "create table t$i()"); + $master->safe_psql('postgres', "create table t$i()"); } $master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $master->restart; -$master->psql('postgres', 'checkpoint'); -my $master_lsn = $master->psql('postgres', +$master->safe_psql('postgres', 'checkpoint'); +my $master_lsn = $master->safe_psql('postgres', 'select pg_current_xlog_location()'); $standby->poll_query_until('postgres', qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()}) or die "slave never caught up"; -$standby->psql('postgres', 'checkpoint'); +$standby->safe_psql('postgres', 'checkpoint'); $standby->restart; -my $standby_ts = $standby->psql('postgres', +my ($psql_ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres', qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}); -is($standby_ts, '', "standby does not return a value after restart"); +is($psql_ret, 3, 'expect error when getting commit timestamp after restart'); +is($standby_ts_stdout, '', "standby does not return a value after restart"); +like($standby_ts_stderr, qr/could not get commit timestamp data/, 'expected err msg after restart'); $master->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $master->restart; @@ -50,7 +52,7 @@ $master->restart; system_or_bail('pg_ctl', '-w', '-D', $standby->data_dir, 'promote'); $standby->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true"); -$standby->psql('postgres', "create table t11()"); -$standby_ts = $standby->psql('postgres', +$standby->safe_psql('postgres', "create table t11()"); +my $standby_ts = $standby->safe_psql('postgres', qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't11'}); isnt($standby_ts, '', "standby gives valid value ($standby_ts) after promotion"); |