Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

xsawyerx (8978)

xsawyerx
  (email not shown publicly)

Journal of xsawyerx (8978)

Wednesday April 22, 2009
10:45 AM

Testing pings with Test::Ping

[ #38846 ]

I had to write a testing suite for a few servers. The most rudimentary test I had to do was ping. Each server had various IPs and since I'm not the one who configured them, I had to make sure whoever did configure them did a good job. Also, some programs ({open,}ssh) do not check if a host is up before trying to connect, so a later test could hang.

This was apparent when one of the servers' IPs' was changed, and all subsequent tests weren't run because the ping test failed. Thank you for regression tests.

Long story short, I wrote Test::Ping to make it easier to test pings on machines. It will support the different behavior and variables of Net::Ping. In fact, that's what it's based on. Here is a sample:

use Test::More tests => 3;
use Test::Ping;

foreach my $host ( qw( server1 server2 server3 ) ) {
    ping_ok( $host, "$host is up!" );
}

There is a working prototype already on GitHub and hopefully I'll get it out on CPAN soon enough.

It might seem too easy or mundane, but I like it and it's another testing module to make things a tad easier.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.