[check_postgres] [commit] Test or new_version_cp

check_postgres at bucardo.org check_postgres at bucardo.org
Thu Apr 23 20:18:02 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

Test or new_version_cp

---
 t/02_new_version_cp.t |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/t/02_new_version_cp.t b/t/02_new_version_cp.t
new file mode 100644
index 0000000..bd1fe65
--- /dev/null
+++ b/t/02_new_version_cp.t
@@ -0,0 +1,34 @@
+#!perl
+
+## Test the "new_version_cp" action
+
+use strict;
+use warnings;
+use Data::Dumper;
+use Test::More tests => 3;
+use lib 't','.';
+use CP_Testing;
+
+use vars qw/$dbh $t/;
+
+my $cp = CP_Testing->new( {default_action => 'new_version_cp'} );
+
+$dbh = $cp->test_database_handle();
+
+my $S = q{Action 'new_version_cp'};
+my $label = 'POSTGRES_NEW_VERSION_CP';
+
+$t=qq{$S fails when called with an invalid option};
+like ($cp->run('foobar=12'), qr{^\s*Usage:}, $t);
+
+$t=qq{$S returns okay for matching version};
+like ($cp->run(''), qr{$label OK:  Version \d+\.\d+\.\d+ is the latest for check_postgres.pl}, $t);
+
+$t=qq{$S returns warning for mismatched version};
+$cp->fake_self_version('1.2.3');
+like ($cp->run(''), qr{$label WARNING:  Version \d+\.\d+\.\d+ of check_postgres.pl exists}, $t);
+
+$cp->restore_self_version();
+
+exit;
+
-- 
1.6.0.5



More information about the Check_postgres mailing list