summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/test-custodian-testfactory.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb
index 953016e..51b066d 100755
--- a/t/test-custodian-testfactory.rb
+++ b/t/test-custodian-testfactory.rb
@@ -87,6 +87,38 @@ class TestTestFactory < Test::Unit::TestCase
#
+ # Test port-guessing.
+ #
+ def test_port_detection
+ data = {
+ "foo must run ftp." => "21",
+ "foo must run ssh." => "22",
+ "foo must run mysql otherwise 'alert'" => "3306",
+ "foo must run redis otherwise 'alert'" => "6379",
+ "foo must run mysql on 33 otherwise 'alert'" => "33",
+ }
+
+ #
+ # Run each test
+ #
+ data.each do |str,prt|
+ assert_nothing_raised do
+
+ obj = Custodian::TestFactory.create( str )
+
+ #
+ # Ensure we got the object, and the port was correct.
+ #
+ assert(obj, "created object via TestFactory.create('#{str}')")
+ assert( obj.port().to_s == prt , "'#{str}' gave expected port '#{prt}'.")
+ end
+ end
+
+ end
+
+
+
+ #
# Test the rsync-test creation.
#
def test_rsync_uri