From 78d28d532d91c2bc5f0c42ea3a9f2c8a0813a34c Mon Sep 17 00:00:00 2001
From: Steve Kemp <steve@steve.org.uk>
Date: Sat, 24 Nov 2012 20:07:38 +0000
Subject:   Test that each test-type returns the correct host.

---
 t/test-custodian-testfactory.rb | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

(limited to 't')

diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb
index a14fce9..8ba315e 100755
--- a/t/test-custodian-testfactory.rb
+++ b/t/test-custodian-testfactory.rb
@@ -254,5 +254,31 @@ class TestTestFactory < Test::Unit::TestCase
     end
   end
 
+
+  #
+  # Test the target of each test is always what we expect.
+  #
+  def test_target_detection
+
+
+    a = Array.new()
+
+    a.push( "test.host.example.com must run ftp.")
+    a.push( "ftp://test.host.example.com/ must run ftp.")
+    a.push( "ftp://test.host.example.com/foo must run ftp.")
+    a.push( "test.host.example.com must run ping.")
+    a.push( "test.host.example.com  must run dns for bytemark.co.uk resolving NS as '80.68.80.26;85.17.170.78;80.68.80.27'.")
+    a.push( "rsync://test.host.example.com must run rsync.")
+    a.push( "rsync://test.host.example.com must run rsync.")
+
+    a.each do |entry|
+      assert_nothing_raised do
+        obj = Custodian::TestFactory.create( entry )
+        assert(obj)
+        assert_equal( "test.host.example.com", obj.target() )
+      end
+    end
+  end
+
 end
 
-- 
cgit v1.2.3