diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-22 16:55:54 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-22 16:55:54 +0100 |
commit | 25b32914b72a5f709eca773f3511cc89c2e710c2 (patch) | |
tree | 4dab9e78e4c6b49220a837b38d463328c05e2983 /test/th_mauve_resolv.rb | |
parent | 3185e5d746abda1b7f42ecdbd74ec14359fda3bc (diff) | |
parent | fd23821950f0562a8995735105cd31fdc6d55933 (diff) |
merge
Diffstat (limited to 'test/th_mauve_resolv.rb')
-rw-r--r-- | test/th_mauve_resolv.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/th_mauve_resolv.rb b/test/th_mauve_resolv.rb new file mode 100644 index 0000000..98b597b --- /dev/null +++ b/test/th_mauve_resolv.rb @@ -0,0 +1,30 @@ + +$:.unshift "../lib" + +require 'mauve/mauve_resolv' + +# +# This allows us to specify IPs for test hostnames, and also to fall back on +# regular DNS if that fails. +# + +module Mauve + class MauveResolv + class << self + alias_method :get_ips_for_without_testing, :get_ips_for + + def get_ips_for_with_testing(host) + lookup = { + "test-1.example.com" => %w(1.2.3.4 2001:1:2:3::4), + "test-2.example.com" => %w(1.2.3.5 2001:1:2:3::5), + "www.example.com" => %w(1.2.3.4), + "www2.example.com" => %w(1.2.3.5 2001:2::2) + } + lookup[host] || get_ips_for_without_testing(host) + end + + alias_method :get_ips_for, :get_ips_for_with_testing + end + end +end + |