postgres.git / summary / log / commit / refs
commit 1c4e88e2fe41dbd1cb3431fbfed5ee6d92bfe089
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed Jul 08 17:41:52 2020 +0000
First released in: 14.0
Add test coverage for pg_current_logfile() function.
There has been no coverage at all up to now. Given Thomas Kellerer's
recent report, I suspect this may fail on (some?) Windows machines,
but let's find out.
Discussion: https://postgr.es/m/412ae8da-76bb-640f-039a-f3513499e53d@gmx.net
src/bin/pg_ctl/t/004_logrotate.pl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl
index 71dbfd20301..acaade8d812 100644
--- a/src/bin/pg_ctl/t/004_logrotate.pl
+++ b/src/bin/pg_ctl/t/004_logrotate.pl
@@ -3,7 +3,7 @@ use warnings;
use PostgresNode;
use TestLib;
-use Test::More tests => 4;
+use Test::More tests => 5;
use Time::HiRes qw(usleep);
# Set up node with logging collector
@@ -47,6 +47,10 @@ for (my $attempts = 0; $attempts < $max_attempts; $attempts++)
like($first_logfile, qr/division by zero/, 'found expected log file content');
+# While we're at it, test pg_current_logfile() function
+is($node->safe_psql('postgres', "SELECT pg_current_logfile('stderr')"),
+ $lfname, 'pg_current_logfile() gives correct answer');
+
# Sleep 2 seconds and ask for log rotation; this should result in
# output into a different log file name.
sleep(2);
[parent: 654242fd81cf]