t/Templates/Plugins/Nagios/check_template-ldap.t

filter: Statementstmt 71.7% 28 / 39 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 68.5% 37 / 54 CC 1 SCAR 0.0
CC
1
Cov
67%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« t/Asnmtap/Plugins/XML.t ↑ Summary t/Templates/Plugins/SOAP/check_template-SOAP.t »
1 #!/usr/bin/env perl -w -I ..
2 #
3 # ... Tests via check_template-ldap.pl
4 #
5 # $Id: check_template-ldap.t, v 1.0 2006/02/01 Alex Peeters Exp $
6 #
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use ASNMTAP::Asnmtap::Plugins::NPTest;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use vars qw($tests);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶BEGIN {$tests = 21; plan tests => $tests}
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 my ($module, $version, $installed);
16 1 $module = 'Net::LDAP';
17 1 $version = '0.33';
18 1 $installed = eval ( "require $module; Exporter::require_version ( '$module', $version );" );
19  
20 1 my $t;
21 1 my $prefix = '../plugins/nagios/templates';
22 1 my $plugin = 'check_template-ldap.pl';
23  
24 1 ▶if ( $installed and -x "$prefix/$plugin" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($installed and -x "$prefix/$plugin") { } 0 1 1
Condition33%1/3
$installed and -x "$prefix/$plugin"
!ll&&!rl&&r
100
MC/DC0%0/2
$installed and -x "$prefix/$plugin"
$installed -x "$prefix/$plugin"
Truth table33%1/3
A and B
A= $installedB= -x "$prefix/$plugin"
ABresult
0X0
100
111
25 0 $t += checkCmd( "$prefix/$plugin -V", 3, "/$plugin/");
26 0 $t += checkCmd( "$prefix/$plugin -h", 3);
27 0 $t += checkCmd( "$prefix/$plugin", 3, '/Missing command line argument host/');
28 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com", 3, '/Missing command line argument port/');
29 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389", 3, '/Missing command line argument password/');
30 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389 --password=password", 3, '/Missing command line argument dn/');
31 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389 --password=password --dn='uid=ldapconsult,ou=People,dc=be'", 3, '/Missing command line argument dnPass/');
32 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389 --password=password --dn='uid=ldapconsult,ou=People,dc=be' --dnPass='consult'", 3, '/Missing command line argument base/');
33 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389 --password=password --dn='uid=ldapconsult,ou=People,dc=be' --dnPass='consult' --base='dc=be'", 3, '/Missing command line argument scope/');
34 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389 --password=password --dn='uid=ldapconsult,ou=People,dc=be' --dnPass='consult' --base='dc=be' --scope='SUB'", 3, '/Missing command line argument filter/');
35 0 $t += checkCmd( "$prefix/$plugin --host=ldap.citap.com --port=389 --password=password --dn='uid=ldapconsult,ou=People,dc=be' --dnPass='consult' --base='dc=be' --scope='SUB' --filter='(uid=alexpeeters)'", 3, "/ERROR: Can't get a connection to ldapserver/" );
36 } else {
37 1 $t += skipMissingCmd( "$prefix/$plugin", $tests );
38 }
39  
40 1 ▶exit(0) if defined($Test::Harness::VERSION);
Branch: 1 branch
BranchTrueFalseTotal
if defined $Test::Harness::VERSION 0 1 1
41 1 exit($tests - $t);
« t/Asnmtap/Plugins/XML.t ↑ Summary t/Templates/Plugins/SOAP/check_template-SOAP.t »