aboutsummaryrefslogtreecommitdiff
path: root/test/th_mauve_resolv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/th_mauve_resolv.rb')
-rw-r--r--test/th_mauve_resolv.rb30
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
+