summaryrefslogtreecommitdiff
path: root/t/00_test_tester.t
blob: 7f6f55f5ec43a28fc2ae5849b6dbbc19bf729e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!perl

## Make sure we have tests for all actions

use 5.006;
use strict;
use warnings;
use Data::Dumper;
use Test::More;
use lib 't','.';
use CP_Testing;

if (!$ENV{RELEASE_TESTING}) {
    plan (skip_all =>  'Test skipped unless environment variable RELEASE_TESTING is set');
}

plan tests => 1;

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';
}
else {
    fail 'Did not find a test for every action';
}

exit;