diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-26 21:02:21 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-26 21:02:21 +0000 |
commit | 6728e60669cfa3011e5ab5f3315feccd6205668d (patch) | |
tree | 74d9596f6d37acab3fc338d642766825eb6be69b /plugins-scripts/t | |
parent | 287f5e29c6e91a4a7afa59158430db3f25f2eb1c (diff) | |
download | monitoring-plugins-6728e60669cfa3011e5ab5f3315feccd6205668d.tar.gz |
Fixed regression where hostnames with hyphens were rejected (1581402 - Holger Weiss)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1528 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts/t')
-rw-r--r-- | plugins-scripts/t/utils.t | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins-scripts/t/utils.t b/plugins-scripts/t/utils.t new file mode 100644 index 00000000..469988c9 --- /dev/null +++ b/plugins-scripts/t/utils.t | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/usr/bin/perl -w -I .. | ||
2 | # | ||
3 | # utils.pm tests | ||
4 | # | ||
5 | # $Id$ | ||
6 | # | ||
7 | |||
8 | #use strict; | ||
9 | use Test::More; | ||
10 | use NPTest; | ||
11 | |||
12 | use lib ".."; | ||
13 | use utils; | ||
14 | |||
15 | my $hostname_checks = { | ||
16 | "www.altinity.com" => 1, | ||
17 | "www.888.com" => 1, | ||
18 | "888.com" => 1, | ||
19 | "host-hyphened.com" => 1, | ||
20 | "rubbish" => 1, | ||
21 | "-start.com" => 0, | ||
22 | "endsindot." => 0, | ||
23 | "lots.of.dots.dot.org" => 1, | ||
24 | "10.20.30.40" => 1, | ||
25 | "10.20.30.40.50" => 0, | ||
26 | "10.20.30" => 0, | ||
27 | }; | ||
28 | |||
29 | plan tests => scalar keys %$hostname_checks; | ||
30 | |||
31 | foreach my $h (sort keys %$hostname_checks) { | ||
32 | is (utils::is_hostname($h), $hostname_checks->{$h}, "$h should return ".$hostname_checks->{$h}); | ||
33 | } | ||
34 | |||