[check_postgres] [commit] Add a test to ensure test coverage of all actions.
check_postgres at bucardo.org
check_postgres at bucardo.org
Thu Apr 23 17:25:14 UTC 2009
Committed by Greg Sabino Mullane <greg at endpoint.com>
Add a test to ensure test coverage of all actions.
Rename walfiles.t to wal_files.t
---
t/00_test_tester.t | 47 +++++++++++++++++++++++++++++++++++
t/{02_walfiles.t => 02_wal_files.t} | 0
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/t/00_test_tester.t b/t/00_test_tester.t
new file mode 100644
index 0000000..9ae0c5e
--- /dev/null
+++ b/t/00_test_tester.t
@@ -0,0 +1,47 @@
+#!perl
+
+## Make sure we have tests for all actions
+
+use strict;
+use warnings;
+use Data::Dumper;
+use DBI;
+use Test::More tests => 1;
+use lib 't','.';
+use CP_Testing;
+
+use vars qw/$dbh $SQL $t $info/;
+
+my $cp = CP_Testing->new();
+
+$dbh = $cp->test_database_handle();
+
+$info = $cp->run('help','--help');
+
+my %action;
+for my $line (split /\n/ => $info) {
+ next if $line !~ /^ (\w+) +\- [A-Z]/;
+ $action{$1}++;
+}
+
+my $ok = 1;
+for my $act (sort keys %action) {
+ ## Special known exceptions
+ next if $act eq 'table_size' or $act eq 'index_size';
+ next if $act eq 'last_autoanalyze' or $act eq 'last_autovacuum';
+
+ my $file = "t/02_$act.t";
+ if (! -e $file) {
+ diag qq{No matching test file found for action "$act" (expected $file)\n};
+ $ok = 0;
+ }
+}
+
+if ($ok) {
+ pass "There is a test for every action\n";
+}
+else {
+ fail "Did not find a test for every action\n";
+}
+
+exit;
diff --git a/t/02_walfiles.t b/t/02_wal_files.t
similarity index 100%
rename from t/02_walfiles.t
rename to t/02_wal_files.t
--
1.6.0.5
More information about the Check_postgres
mailing list