summaryrefslogtreecommitdiff
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
commite9b33a69f09a5408e2fb879f7fec2eaa68b5ca9e (patch)
treeed2bb5a4c508b689e52824b23d0696bc1009eb74
parent14013d8db1f5f7ed35f6132a078b7d6726da2d7c (diff)
Added port-guessing test.
-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