| 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
Condition33%1/3
$installed and -x "$prefix/$plugin"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 41 | 1 | exit($tests - $t); | |||||||||||||||||||||||||||