From e3550fc78d1ef666bfd909394b0a66cfd0ac4cb6 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 23 Nov 2012 13:39:56 +0000 Subject: Renamed. --- t/test-custodian-util-dns.rb | 78 ++++++++++++++++++++++++++++++++++++++++++++ t/test-dnsutil.rb | 78 -------------------------------------------- 2 files changed, 78 insertions(+), 78 deletions(-) create mode 100755 t/test-custodian-util-dns.rb delete mode 100755 t/test-dnsutil.rb diff --git a/t/test-custodian-util-dns.rb b/t/test-custodian-util-dns.rb new file mode 100755 index 0000000..15cbe09 --- /dev/null +++ b/t/test-custodian-util-dns.rb @@ -0,0 +1,78 @@ +#!/usr/bin/ruby1.8 -I./lib/ -I../lib/ + + +require 'custodian/util/dns' +require 'test/unit' + + + +# +# Unit test for our DNS utility class. +# +# +class TestDNSUtil < Test::Unit::TestCase + + # + # Create the test suite environment: NOP. + # + def setup + end + + # + # Destroy the test suite environment: NOP. + # + def teardown + end + + + # + # Test forward lookups + # + def test_lookup + + # + # IPv6 lookup + # + details = Custodian::Util::DNS.hostname_to_ip( "ipv6.steve.org.uk" ) + assert( details =~ /2001:41c8:125:46::10/i ) + + # + # IPv4 lookup + # + details = Custodian::Util::DNS.hostname_to_ip( "ipv4.steve.org.uk" ) + assert( details =~ /80.68.85.46/i ) + + # + # Failure case + # + details = Custodian::Util::DNS.hostname_to_ip( "this.doesnot.exist" ) + assert( details.nil? ) + + end + + + # + # Test forward lookups + # + def test_reverse_lookup + + # + # IPv6 lookup + # + details = Custodian::Util::DNS.ip_to_hostname( "2001:41c8:125:46::22" ) + assert( details =~ /ssh.steve.org.uk/i ) + + # + # IPv4 lookup + # + details = Custodian::Util::DNS.ip_to_hostname( "80.68.85.48" ) + assert( details =~ /ssh.steve.org.uk/i ) + + # + # Bogus lookup - should return nil. + # + details = Custodian::Util::DNS.ip_to_hostname( "800.683.853.348" ) + assert( details.nil? ) + end + +end diff --git a/t/test-dnsutil.rb b/t/test-dnsutil.rb deleted file mode 100755 index 15cbe09..0000000 --- a/t/test-dnsutil.rb +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/ruby1.8 -I./lib/ -I../lib/ - - -require 'custodian/util/dns' -require 'test/unit' - - - -# -# Unit test for our DNS utility class. -# -# -class TestDNSUtil < Test::Unit::TestCase - - # - # Create the test suite environment: NOP. - # - def setup - end - - # - # Destroy the test suite environment: NOP. - # - def teardown - end - - - # - # Test forward lookups - # - def test_lookup - - # - # IPv6 lookup - # - details = Custodian::Util::DNS.hostname_to_ip( "ipv6.steve.org.uk" ) - assert( details =~ /2001:41c8:125:46::10/i ) - - # - # IPv4 lookup - # - details = Custodian::Util::DNS.hostname_to_ip( "ipv4.steve.org.uk" ) - assert( details =~ /80.68.85.46/i ) - - # - # Failure case - # - details = Custodian::Util::DNS.hostname_to_ip( "this.doesnot.exist" ) - assert( details.nil? ) - - end - - - # - # Test forward lookups - # - def test_reverse_lookup - - # - # IPv6 lookup - # - details = Custodian::Util::DNS.ip_to_hostname( "2001:41c8:125:46::22" ) - assert( details =~ /ssh.steve.org.uk/i ) - - # - # IPv4 lookup - # - details = Custodian::Util::DNS.ip_to_hostname( "80.68.85.48" ) - assert( details =~ /ssh.steve.org.uk/i ) - - # - # Bogus lookup - should return nil. - # - details = Custodian::Util::DNS.ip_to_hostname( "800.683.853.348" ) - assert( details.nil? ) - end - -end -- cgit v1.2.1