diff options
author | Greg Sabino Mullane | 2009-04-23 20:17:51 +0000 |
---|---|---|
committer | Greg Sabino Mullane | 2009-04-23 20:17:51 +0000 |
commit | 72fc761f64b317dd62f434c4f0d8e56a88cfe46c (patch) | |
tree | aec191e3b4261ba3bed113f40a15f5dd3241bbf0 | |
parent | cb59ed885e1b8f1a44dbc00c970429cb576bdbae (diff) |
Test or new_version_cp
-rw-r--r-- | 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 000000000..bd1fe6506 --- /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; + |