From 6f25706ee9827a97e8c5efbc2be8bf00a47e41e8 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 24 Jan 2011 23:48:12 -0500 Subject: [PATCH] The wal_files check must take a positive integer, not just any ol' integer. --- check_postgres.pl | 2 +- t/02_wal_files.t | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/check_postgres.pl b/check_postgres.pl index 478726f77..5243dfc06 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -7331,7 +7331,7 @@ sub check_wal_files { ## Critical and warning are the number of files ## Example: --critical=40 - my ($warning, $critical) = validate_range({type => 'integer', leastone => 1}); + my ($warning, $critical) = validate_range({type => 'positive integer', leastone => 1}); ## Figure out where the pg_xlog directory is $SQL = q{SELECT count(*) AS count FROM pg_ls_dir('pg_xlog') WHERE pg_ls_dir ~ E'^[0-9A-F]{24}$'}; ## no critic (RequireInterpolationOfMetachars) diff --git a/t/02_wal_files.t b/t/02_wal_files.t index c0d0995a7..f1d14c58b 100644 --- a/t/02_wal_files.t +++ b/t/02_wal_files.t @@ -23,8 +23,8 @@ $t=qq{$S fails when called with an invalid option}; like ($cp->run('foobar=12'), qr{^\s*Usage:}, $t); $t=qq{$S fails when called with an invalid option}; -like ($cp->run('--warning=30%'), qr{ERROR:.+must be an integer}, $t); -like ($cp->run('--warning=-30'), qr{ERROR:.+must be an integer}, $t); +like ($cp->run('--warning=30%'), qr{ERROR:.+must be a positive integer}, $t); +like ($cp->run('--warning=-30'), qr{ERROR:.+must be a positive integer}, $t); my $ver = $dbh->{pg_server_version}; if ($ver < 80100) { @@ -41,11 +41,11 @@ if ($ver < 80100) { $t=qq{$S works as expected for warnings}; like ($cp->run('--warning=30'), qr{^$label OK}, $t); -like ($cp->run('--warning=0'), qr{^$label WARNING}, $t); +like ($cp->run('--warning=1'), qr{^$label WARNING}, $t); $t=qq{$S works as expected for criticals}; like ($cp->run('--critical=30'), qr{^$label OK}, $t); -like ($cp->run('--critical=0'), qr{^$label CRITICAL}, $t); +like ($cp->run('--critical=1'), qr{^$label CRITICAL}, $t); $cp->drop_schema_if_exists(); $cp->create_fake_pg_table('pg_ls_dir', 'text'); -- 2.30.2