blob: 2ab76e4bb00850355005a50b72b38803b669f485 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Test::Command tests => (22*3);
my $icli = 'bin/icli -f t/in/status.dat -c t/in/objects.cache';
my $EMPTY = q{};
my $cmd = Test::Command->new(cmd => $icli);
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/standard');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -V");
$cmd->exit_is_num(0);
$cmd->stdout_like(qr{ ^ icli \s version \s \S+ $ }x);
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lh -g local");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/hosts_group_local');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lh -s");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/hosts_short');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -ls -h steel-vpn,steel.derf0.net");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/host_steel_steel');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lh");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_hosts');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lh -C");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_hosts_nc');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -ls");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_services');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -ls -C");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_services_nc');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -ls -g local");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/services_group_local');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lh -g derf-remote,http-servers");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/hosts_group_reduce');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -ls -s");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/services_short');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -ls -h steel.derf0.net");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_services_single');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lq");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_queue');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -lq -h aneurysm");
$cmd->exit_is_num(0);
$cmd->stdout_is_file('t/out/list_queue_aneurysm');
$cmd->stderr_is_eq($EMPTY);
$cmd = Test::Command->new(cmd => "$icli -g invalid");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("Unknown hostgroup: invalid\n");
$cmd = Test::Command->new(cmd => "$icli -h invalid");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("Unknown host: invalid\n");
$cmd = Test::Command->new(cmd => "$icli -lh -h invalid");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("Unknown host: invalid\n");
$cmd = Test::Command->new(cmd => "$icli -l INVALID");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("See perldoc -F bin/icli\n");
$icli = "bin/icli -f t/in/status.dat.weird.1 -c t/in/objects.cache";
$cmd = Test::Command->new(cmd => $icli);
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("Unknown field in t/in/status.dat.weird.1: bork\n");
$icli = "bin/icli -f t/in/status.dat.weird.2 -c t/in/objects.cache";
$cmd = Test::Command->new(cmd => "$icli -lh -h alpha");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("Unknown host state: 23\n");
$cmd = Test::Command->new(cmd => "$icli -ls -h aneurysm");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq("Unknown service state: 23\n");
|