'txntime-fail' => q{Query failed},
'txntime-msg' => q{longest txn: $1s},
'txntime-none' => q{No transactions},
+ 'txnwrap-wbig' => q{The 'warning' value must be less than 2 billion},
+ 'txnwrap-cbig' => q{The 'critical' value must be less than 2 billion},
'unknown-error' => q{Unknown error},
'usage' => qq{\nUsage: \$1 <options>\n Try "\$1 --help" for a complete list of options\n\n},
'vac-msg' => q{DB: $1 TABLE: $2},
'txntime-fail' => q{Échec de la requête},
'txntime-msg' => q{Transaction la plus longue : $1s},
'txntime-none' => q{Aucune transaction},
+'txnwrap-wbig' => q{The 'warning' value must be less than 2 billion},
+'txnwrap-cbig' => q{The 'critical' value must be less than 2 billion},
'unknown-error' => q{erreur inconnue},
'usage' => qq{\nUsage: \$1 <options>\n Essayez « \$1 --help » pour liste complète des options\n\n},
'vac-msg' => q{Base de données : $1 Table : $2},
default_critical => 1_400_000_000,
});
+ if ($warning and $warning >= 2_000_000_000) {
+ ndie msg('txnwrap-wbig');
+ }
+ if ($critical and $critical >= 2_000_000_000) {
+ ndie msg('txnwrap-cbig');
+ }
+
$SQL = q{SELECT datname, age(datfrozenxid) FROM pg_database WHERE datallowconn ORDER BY 1, 2};
my $info = run_command($SQL, { regex => qr[\w+\s+\|\s+\d+] } );
use strict;
use warnings;
use Data::Dumper;
-use Test::More tests => 14;
+use Test::More tests => 16;
use lib 't','.';
use CP_Testing;
$t = qq{$S identifies each database};
like ($result, qr{ardala=\d+ beedeebeedee=\d+ postgres=\d+ template1=\d+}, $t);
-my $txn_measure;
$result =~ /ardala=(\d+)/;
-$txn_measure = $1;
+my $txn_measure = $1;
$t = qq{$S identifies host};
like ($result, qr{host:$host}, $t);
+## 8.1 starts a little over 1 billion
$t = qq{$S accepts valid -w input};
-like ($cp->run(q{-w 1000000}), qr/$label OK/, $t);
+like ($cp->run(q{-w 1500000000}), qr{$label OK}, $t);
$t = qq{$S flags invalid -w input};
-for (-1, 0, 'a') {
- like ($cp->run(qq{-w $_}), qr/ERROR: Invalid argument.*must be a positive integer/, $t . " ($_)");
+for my $arg (-1, 0, 'a') {
+ like ($cp->run(qq{-w $arg}), qr{ERROR: Invalid argument.*must be a positive integer}, "$t ($arg)");
}
+$t = qq{$S rejects warning values 2 billion or higher};
+like ($cp->run(qq{-w 2000000000}), qr{ERROR:.+less than 2 billion}, $t);
+
+$t = qq{$S rejects critical values 2 billion or higher};
+like ($cp->run(qq{-c 2200000000}), qr{ERROR:.+less than 2 billion}, $t);
+
$t = qq{$S accepts valid -c input};
-like ($cp->run(q{-c 1000000}), qr/$label OK/, $t);
+like ($cp->run(q{-c 1400000000}), qr{$label OK}, $t);
$t = qq{$S flags invalid -c input};
-for (-1, 0, 'a') {
- like ($cp->run(qq{-c $_}), qr/ERROR: Invalid argument.*must be a positive integer/, $t . " ($_)");
+for my $arg (-1, 0, 'a') {
+ like ($cp->run(qq{-c $arg}), qr{ERROR: Invalid argument.*must be a positive integer}, "$t ($arg)");
}
$t = qq{$S sees impending wrap-around};
-like ($cp->run('-c ' . int ($txn_measure / 2)), qr/$label CRITICAL/, $t);
+like ($cp->run('-c ' . int ($txn_measure / 2)), qr{$label CRITICAL}, $t);
$t = qq{$S sees no impending wrap-around};
-like ($cp->run('-v -c ' . ($txn_measure * 2)), qr/$label OK/, $t);
+like ($cp->run('-c 1999000000'), qr{$label OK}, $t);
$t .= ' (mrtg)';
-like ($cp->run('-c 100000 --output=mrtg'), qr{\d+\n0\n\nDB: ardala}, $t);
+like ($cp->run('-c 1400000000 --output=mrtg'), qr{\d+\n0\n\nDB: \w+}, $t);
+exit;