Add test for --action=wal_files --lsfunc
authorChristoph Berg <[email protected]>
Fri, 17 Jul 2015 20:29:30 +0000 (22:29 +0200)
committerChristoph Berg <[email protected]>
Fri, 17 Jul 2015 20:29:30 +0000 (22:29 +0200)
check_postgres.pl
t/02_wal_files.t

index 7f4aefe7e86eb87f20cfec307ec350f9b425fca0..97e0ad596edc6f20208d129ca2fb95d4461654cf 100755 (executable)
@@ -10127,6 +10127,10 @@ Items not specifically attributed are by GSM (Greg Sabino Mullane).
   Add Spanish message translations
     (Luis Vazquez)
 
+  Allow a wrapper function to run wal_files and archive_ready actions as
+  non-superuser
+    (Joshua Elsasser)
+
 =item B<Version 2.22.0> June 30, 2015
 
   Add xact timestamp support to hot_standby_delay.
index 7241825e020294b225d6b4e46495c1cf0cfa0d8d..c8e0805548413cbac459f3a61fe7b4f7343939e1 100644 (file)
@@ -6,7 +6,7 @@ use 5.006;
 use strict;
 use warnings;
 use Data::Dumper;
-use Test::More tests => 11;
+use Test::More tests => 12;
 use lib 't','.';
 use CP_Testing;
 
@@ -64,6 +64,18 @@ is ($cp->run('--critical=1 --output=mrtg'), "99\n0\n\n\n", $t);
 $t=qq{$S returns correct MRTG information};
 is ($cp->run('--critical=101 --output=mrtg'), "99\n0\n\n\n", $t);
 
+# test --lsfunc
+$dbh->do(q{CREATE FUNCTION ls_xlog_dir()
+      RETURNS SETOF TEXT
+      AS $$ SELECT pg_ls_dir('pg_xlog') $$
+      LANGUAGE SQL
+      SECURITY DEFINER});
+$cp->create_fake_pg_table('ls_xlog_dir', ' ');
+$dbh->do(q{INSERT INTO cptest.ls_xlog_dir SELECT 'ABCDEF123456ABCDEF123456' FROM generate_series(1,55)});
+$dbh->commit();
+$t=qq{$S returns correct number of files};
+like ($cp->run('--critical=1 --lsfunc=ls_xlog_dir'), qr{^$label CRITICAL.+ 55 \|}, $t);
+
 $cp->drop_schema_if_exists();
 
 exit;