summaryrefslogtreecommitdiff
path: root/t/test-custodian-testfactory.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-02-25 17:11:02 +0000
committerSteve Kemp <steve@steve.org.uk>2013-02-25 17:11:02 +0000
commit996f885d208ae22f5178cbbfa0249233a1f1848e (patch)
tree8a01a0928021a5e69be278f710f7d1ba2a30165c /t/test-custodian-testfactory.rb
parent3d3ee6446a71cfff6b29ffe95cc08d86e8e85388 (diff)
Added port-guessing test.
Diffstat (limited to 't/test-custodian-testfactory.rb')
-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