Skip to content

Commit

Permalink
test error resolving host name
Browse files Browse the repository at this point in the history
The top level domain '.invalid' is reserved for such tests.
  • Loading branch information
auerswal authored and schweikert committed Aug 1, 2024
1 parent 43a99b8 commit fc2fcb3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ci/test-01-basics.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w

use Test::Command tests => 12;
use Test::Command tests => 15;
use Test::More;

# ping 127.0.0.1
Expand Down Expand Up @@ -45,3 +45,11 @@
});
$cmd->stderr_like(qr{127\.0\.0\.1 : \d\.\d+ \d\.\d+ \d\.\d+\n});
}

# invalid target name
{
my $cmd = Test::Command->new(cmd => "fping host.name.invalid");
$cmd->exit_is_num(2);
$cmd->stdout_is_eq("");
$cmd->stderr_like(qr{host\.name\.invalid: .+\n});
}
26 changes: 25 additions & 1 deletion ci/test-09-option-r-t.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w

use Test::Command tests => 27;
use Test::Command tests => 30;
use Test::More;

# -R random bytes
Expand Down Expand Up @@ -76,6 +76,30 @@
});
}

# fping -s (both valid and invalid host name)
{
my $cmd = Test::Command->new(cmd => "fping -s 127.0.0.1 host.name.invalid");
$cmd->exit_is_num(2);
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
$cmd->stderr_like(qr{host\.name\.invalid: .+
\s*
\s*1 targets
\s*1 alive
\s*0 unreachable
\s*1 unknown addresses
\s*
\s*0 timeouts \(waiting for response\)
\s*1 ICMP Echos sent
\s*1 ICMP Echo Replies received
\s*0 other ICMP received
\s*\d\.\d+ ms \(min round trip time\)
\s*\d\.\d+ ms \(avg round trip time\)
\s*\d\.\d+ ms \(max round trip time\)
\s*\d\.\d+ sec \(elapsed real time\)
});
}

# fping -S
{
my $cmd = Test::Command->new(cmd => "fping -S 127.0.0.1 127.0.0.1");
Expand Down

0 comments on commit fc2fcb3

Please sign in to comment.