summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:47 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:19:47 +0000
commite716a49dabe2c086a97e2d8b3cffe5cf369ad026 (patch)
treee7e98125f89941db4c9d0f48f2df9c410467a3d8 /t
parentaf2ee063abea8235a8cbd1448533e4f4fbc0d0af (diff)
Removed spaces inside parenthesis.
Diffstat (limited to 't')
-rwxr-xr-xt/test-custodian-alertfactory.rb22
-rwxr-xr-xt/test-custodian-parser.rb130
-rwxr-xr-xt/test-custodian-queue.rb6
-rwxr-xr-xt/test-custodian-settings.rb34
-rwxr-xr-xt/test-custodian-testfactory.rb114
-rwxr-xr-xt/test-custodian-util-bytemark.rb4
-rwxr-xr-xt/test-custodian-util-dns.rb36
-rwxr-xr-xt/test-custodian-util-ping.rb24
-rwxr-xr-xt/test-custodian-util-timespan.rb98
-rwxr-xr-xt/test-http-vs-https.rb28
-rwxr-xr-xt/test-ldap-probe.rb14
11 files changed, 255 insertions, 255 deletions
diff --git a/t/test-custodian-alertfactory.rb b/t/test-custodian-alertfactory.rb
index eea35ac..c18e719 100755
--- a/t/test-custodian-alertfactory.rb
+++ b/t/test-custodian-alertfactory.rb
@@ -31,8 +31,8 @@ class TestAlertFactory < Test::Unit::TestCase
# Ensure we can create each of the two alert types we care about
#
methods = []
- methods.push( 'file' )
- methods.push( 'smtp' )
+ methods.push('file')
+ methods.push('smtp')
#
# Mauve + Redis are optional
@@ -54,29 +54,29 @@ class TestAlertFactory < Test::Unit::TestCase
mauve = false
end
- methods.push( 'redis' ) if redis
- methods.push( 'mauve' ) if mauve
+ methods.push('redis') if redis
+ methods.push('mauve') if mauve
methods.each do |name|
#
# Use the factory to instantiate the correct object.
#
- obj = Custodian::AlertFactory.create( name, nil )
+ obj = Custodian::AlertFactory.create(name, nil)
#
# Get the name of the class, and ensure it matches
# what we expect.
#
a_type = obj.get_type
- assert_equal( name, a_type)
+ assert_equal(name, a_type)
#
# Ensure that the object implements the raise() + clear()
# methods we mandate.
#
- assert( obj.respond_to? 'raise' )
- assert( obj.respond_to? 'clear' )
+ assert(obj.respond_to? 'raise')
+ assert(obj.respond_to? 'clear')
end
@@ -84,17 +84,17 @@ class TestAlertFactory < Test::Unit::TestCase
# Creating an alert we don't know about is an error
#
assert_raise ArgumentError do
- obj = Custodian::AlertFactory.create( 'not found', nil )
+ obj = Custodian::AlertFactory.create('not found', nil)
end
#
# A string is mandatory
#
assert_raise ArgumentError do
- obj = Custodian::AlertFactory.create( nil, nil )
+ obj = Custodian::AlertFactory.create(nil, nil)
end
assert_raise ArgumentError do
- obj = Custodian::AlertFactory.create( [], nil )
+ obj = Custodian::AlertFactory.create([], nil)
end
end
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb
index bbdb8ad..514f2a4 100755
--- a/t/test-custodian-parser.rb
+++ b/t/test-custodian-parser.rb
@@ -51,8 +51,8 @@ class TestCustodianParser < Test::Unit::TestCase
def test_period
parser = Custodian::Parser.new
- result = parser.parse_line( 'example.vm.bytemark.co.uk must run ping except between 00-23' )
- assert( result.nil? )
+ result = parser.parse_line('example.vm.bytemark.co.uk must run ping except between 00-23')
+ assert(result.nil?)
end
@@ -72,20 +72,20 @@ class TestCustodianParser < Test::Unit::TestCase
parser = Custodian::Parser.new
# 1.a. Comment lines return nil.
- result = parser.parse_line( '# this is a comment' )
- assert( result.nil? )
+ result = parser.parse_line('# this is a comment')
+ assert(result.nil?)
# 1.b. Non-strings are an error
assert_raise ArgumentError do
- result = parser.parse_line( nil )
+ result = parser.parse_line(nil)
end
# 1.c. Adding a test will return an array of test-objects.
- result = parser.parse_line( "smtp.bytemark.co.uk must run smtp on 25 otherwise 'failure'." )
- assert( !result.nil? )
- assert( result.kind_of? Array )
- assert( result.size == 1 )
+ result = parser.parse_line("smtp.bytemark.co.uk must run smtp on 25 otherwise 'failure'.")
+ assert(!result.nil?)
+ assert(result.kind_of? Array)
+ assert(result.size == 1)
#
@@ -94,15 +94,15 @@ class TestCustodianParser < Test::Unit::TestCase
parser = Custodian::Parser.new
# 2.a. Comment lines return nil.
tmp = []
- tmp.push( '# This is a comment..' )
- assert( parser.parse_lines( tmp ).nil? )
+ tmp.push('# This is a comment..')
+ assert(parser.parse_lines(tmp).nil?)
# 2.b. Adding a test will return an array of test-objects.
tmp = []
- tmp.push( "smtp.bytemark.co.uk must run ssh on 22 otherwise 'oops'." )
- ret = parser.parse_lines( tmp )
- assert( ret.kind_of? Array )
- assert( ret.size == 1 )
+ tmp.push("smtp.bytemark.co.uk must run ssh on 22 otherwise 'oops'.")
+ ret = parser.parse_lines(tmp)
+ assert(ret.kind_of? Array)
+ assert(ret.size == 1)
#
# 3. By lines
@@ -113,16 +113,16 @@ class TestCustodianParser < Test::Unit::TestCase
# This is a comment
# This is also a fine comment
EOF
- assert( parser.parse_lines( str ).nil? )
+ assert(parser.parse_lines(str).nil?)
# 3.b. Adding a test will return an array of test-objects.
str = <<EOF
smtp.bytemark.co.uk must run smtp on 25.
google.com must run ping otherwise 'internet broken?'.
EOF
- ret = parser.parse_lines( str )
- assert( ret.kind_of? Array )
- assert( ret.size == 1 )
+ ret = parser.parse_lines(str)
+ assert(ret.kind_of? Array)
+ assert(ret.size == 1)
end
@@ -147,15 +147,15 @@ EOF
#
# Test the parser with this text
#
- parser.parse_lines( text )
+ parser.parse_lines(text)
#
# We should now have two macros.
#
macros = parser.macros
- assert( ! macros.empty? )
- assert( macros.size == 2 )
+ assert(! macros.empty?)
+ assert(macros.size == 2)
end
@@ -172,21 +172,21 @@ EOF
# Input text
#
text = []
- text.push( 'FOO is kvm1.vm.bytemark.co.uk.' )
- text.push( 'FOO2 is kvm2.vm.bytemark.co.uk.' )
+ text.push('FOO is kvm1.vm.bytemark.co.uk.')
+ text.push('FOO2 is kvm2.vm.bytemark.co.uk.')
#
# Test the parser with this text
#
- parser.parse_lines( text )
+ parser.parse_lines(text)
#
# We should now have two macros.
#
macros = parser.macros
- assert( ! macros.empty? )
- assert( macros.size == 2 )
+ assert(! macros.empty?)
+ assert(macros.size == 2)
end
@@ -203,14 +203,14 @@ EOF
# Input text to parse.
#
text = []
- text.push( 'FOO is kvm1.vm.bytemark.co.uk.' )
- text.push( 'FOO is kvm2.vm.bytemark.co.uk.' )
+ text.push('FOO is kvm1.vm.bytemark.co.uk.')
+ text.push('FOO is kvm2.vm.bytemark.co.uk.')
#
# Test the parser with this text
#
assert_raise ArgumentError do
- parser.parse_lines( text )
+ parser.parse_lines(text)
end
@@ -218,8 +218,8 @@ EOF
# We should now have one macro.
#
macros = parser.macros
- assert( ! macros.empty? )
- assert( macros.size == 1 )
+ assert(! macros.empty?)
+ assert(macros.size == 1)
end
@@ -235,42 +235,42 @@ EOF
#
parser = Custodian::Parser.new
macros = parser.macros
- assert( macros.empty? )
+ assert(macros.empty?)
#
# Expand a line - which should result in no change
# as the line does not involve a known-macro
#
in_txt = 'example.bytemark.co.uk must run smtp.'
- out_txt = parser.expand_macro( in_txt )
+ out_txt = parser.expand_macro(in_txt)
#
# The difference is the return value will be an array
#
- assert( out_txt.kind_of? Array )
- assert( out_txt.size == 1 )
- assert( out_txt[0] == in_txt )
+ assert(out_txt.kind_of? Array)
+ assert(out_txt.size == 1)
+ assert(out_txt[0] == in_txt)
#
# Now define a macro
#
- parser.parse_line( 'TARGET is example1.bytemark.co.uk and example2.bytemark.co.uk.' )
+ parser.parse_line('TARGET is example1.bytemark.co.uk and example2.bytemark.co.uk.')
macros = parser.macros
- assert( !macros.empty? )
+ assert(!macros.empty?)
#
# Now we have a two-host macro, repeat the expansion
#
- ret = parser.expand_macro( 'TARGET must run smtp on 25.' )
+ ret = parser.expand_macro('TARGET must run smtp on 25.')
#
# The result should be an array
#
- assert( ret.kind_of? Array )
- assert_equal( ret.size, 2 )
- assert( ret[0] =~ /example1/)
- assert( ret[1] =~ /example2/)
+ assert(ret.kind_of? Array)
+ assert_equal(ret.size, 2)
+ assert(ret[0] =~ /example1/)
+ assert(ret[1] =~ /example2/)
end
@@ -298,17 +298,17 @@ EOF
#
# Create the new parser
#
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
- assert( !obj.nil? )
- assert( obj.kind_of? Array )
- assert( obj.size == 1 )
- assert_equal( obj[0].to_s, str )
+ assert(!obj.nil?)
+ assert(obj.kind_of? Array)
+ assert(obj.size == 1)
+ assert_equal(obj[0].to_s, str)
if follow
- assert( obj[0].follow_redirects? )
+ assert(obj[0].follow_redirects?)
else
- assert( ! obj[0].follow_redirects? )
+ assert(! obj[0].follow_redirects?)
end
end
end
@@ -337,17 +337,17 @@ EOF
#
# Create the new parser
#
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
- assert( !obj.nil? )
- assert( obj.kind_of? Array )
- assert( obj.size == 1 )
- assert_equal( obj[0].to_s, str )
+ assert(!obj.nil?)
+ assert(obj.kind_of? Array)
+ assert(obj.size == 1)
+ assert_equal(obj[0].to_s, str)
if cb
- assert( obj[0].cache_busting? )
+ assert(obj[0].cache_busting?)
else
- assert( ! obj[0].cache_busting? )
+ assert(! obj[0].cache_busting?)
end
end
end
@@ -383,17 +383,17 @@ EOF
#
# Create the new parser
#
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
- assert( !obj.nil? )
- assert( obj.kind_of? Array )
- assert( obj.size == 1 )
- assert_equal( obj[0].to_s, str )
+ assert(!obj.nil?)
+ assert(obj.kind_of? Array)
+ assert(obj.size == 1)
+ assert_equal(obj[0].to_s, str)
if fail.nil?
- assert( obj[0].get_notification_text.nil? )
+ assert(obj[0].get_notification_text.nil?)
else
- assert_equal( obj[0].get_notification_text, fail )
+ assert_equal(obj[0].get_notification_text, fail)
end
end
diff --git a/t/test-custodian-queue.rb b/t/test-custodian-queue.rb
index bec83e2..bcd615c 100755
--- a/t/test-custodian-queue.rb
+++ b/t/test-custodian-queue.rb
@@ -40,7 +40,7 @@ class TestCustodianQueue < Test::Unit::TestCase
# creation will fail
assert_raise RuntimeError do
- t = Custodian::QueueType.create( 'foo' )
+ t = Custodian::QueueType.create('foo')
end
end
@@ -50,7 +50,7 @@ class TestCustodianQueue < Test::Unit::TestCase
def test_redis
q = nil
assert_nothing_raised do
- q = Custodian::QueueType.create( 'redis' )
+ q = Custodian::QueueType.create('redis')
end
#
@@ -68,7 +68,7 @@ class TestCustodianQueue < Test::Unit::TestCase
def test_beanstalkd
q = nil
assert_nothing_raised do
- q = Custodian::QueueType.create( 'redis' )
+ q = Custodian::QueueType.create('redis')
end
#
diff --git a/t/test-custodian-settings.rb b/t/test-custodian-settings.rb
index 1923b0f..74f881b 100755
--- a/t/test-custodian-settings.rb
+++ b/t/test-custodian-settings.rb
@@ -32,9 +32,9 @@ class TestConfigurationSingleton < Test::Unit::TestCase
a = Custodian::Settings.instance
b = Custodian::Settings.instance
- assert( a )
- assert( b )
- assert_equal( a.object_id, b.object_id )
+ assert(a)
+ assert(b)
+ assert_equal(a.object_id, b.object_id)
end
@@ -47,37 +47,37 @@ class TestConfigurationSingleton < Test::Unit::TestCase
# retry delay - probably unset.
a = settings.retry_delay
- assert( a.class == Fixnum )
+ assert(a.class == Fixnum)
# store a number
- settings._store( 'retry_delay', 5 )
+ settings._store('retry_delay', 5)
a = settings.retry_delay
- assert( a.class == Fixnum )
- assert( a == 5 )
+ assert(a.class == Fixnum)
+ assert(a == 5)
# store a string
- settings._store( 'retry_delay', '35' )
+ settings._store('retry_delay', '35')
a = settings.retry_delay
- assert( a.class == Fixnum )
- assert( a == 35 )
+ assert(a.class == Fixnum)
+ assert(a == 35)
# timeout - probably unset.
a = settings.timeout
- assert( a.class == Fixnum )
+ assert(a.class == Fixnum)
# store a number
- settings._store( 'timeout', 5 )
+ settings._store('timeout', 5)
a = settings.timeout
- assert( a.class == Fixnum )
- assert( a == 5 )
+ assert(a.class == Fixnum)
+ assert(a == 5)
# store a string
- settings._store( 'timeout', '35' )
+ settings._store('timeout', '35')
a = settings.timeout
- assert( a.class == Fixnum )
- assert( a == 35 )
+ assert(a.class == Fixnum)
+ assert(a == 35)
end
diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb
index af3e3b3..bde76f2 100755
--- a/t/test-custodian-testfactory.rb
+++ b/t/test-custodian-testfactory.rb
@@ -28,11 +28,11 @@ class TestTestFactory < Test::Unit::TestCase
def test_init
assert_raise ArgumentError do
- obj = Custodian::TestFactory.create( nil, nil )
+ obj = Custodian::TestFactory.create(nil, nil)
end
assert_raise ArgumentError do
- obj = Custodian::TestFactory.create( [], nil )
+ obj = Custodian::TestFactory.create([], nil)
end
@@ -45,15 +45,15 @@ class TestTestFactory < Test::Unit::TestCase
def test_ftp_uri
assert_nothing_raised do
- assert( Custodian::TestFactory.create( 'ftp.example.com must run ftp.' ) )
- assert( Custodian::TestFactory.create( 'ftp://ftp.example.com/ must run ftp.' ) )
- assert( Custodian::TestFactory.create( 'ftp://ftp.example.com/ must run ftp on 21.' ) )
- assert( Custodian::TestFactory.create( "ftp://ftp.example.com/ must run ftp on 21 otherwise 'xxx'." ) )
+ assert(Custodian::TestFactory.create('ftp.example.com must run ftp.'))
+ assert(Custodian::TestFactory.create('ftp://ftp.example.com/ must run ftp.'))
+ assert(Custodian::TestFactory.create('ftp://ftp.example.com/ must run ftp on 21.'))
+ assert(Custodian::TestFactory.create("ftp://ftp.example.com/ must run ftp on 21 otherwise 'xxx'."))
end
- assert( Custodian::TestFactory.create( 'ftp.example.com must run ftp.' )[0].target == 'ftp.example.com' )
- assert( Custodian::TestFactory.create( 'ftp://ftp.example.com/ must run ftp.' )[0].target == 'ftp.example.com' )
+ assert(Custodian::TestFactory.create('ftp.example.com must run ftp.')[0].target == 'ftp.example.com')
+ assert(Custodian::TestFactory.create('ftp://ftp.example.com/ must run ftp.')[0].target == 'ftp.example.com')
#
@@ -72,12 +72,12 @@ class TestTestFactory < Test::Unit::TestCase
data.each do |str,prt|
assert_nothing_raised do
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
- assert( obj.kind_of? Array )
- assert( ! obj.empty? )
- assert_equal( obj[0].get_type, 'ftp' )
- assert_equal( obj[0].port.to_s, prt )
+ assert(obj.kind_of? Array)
+ assert(! obj.empty?)
+ assert_equal(obj[0].get_type, 'ftp')
+ assert_equal(obj[0].port.to_s, prt)
end
end
@@ -104,12 +104,12 @@ class TestTestFactory < Test::Unit::TestCase
data.each do |str,prt|
assert_nothing_raised do
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
assert(obj)
- assert( obj.kind_of? Array )
- assert( ! obj.empty? )
- assert( obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.")
+ assert(obj.kind_of? Array)
+ assert(! obj.empty?)
+ assert(obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.")
end
end
@@ -124,16 +124,16 @@ class TestTestFactory < Test::Unit::TestCase
assert_nothing_raised do
- assert( Custodian::TestFactory.create( 'example.com must run rsync.' ) )
- assert( Custodian::TestFactory.create( 'ftp://example.com/ must run rsync.' ) )
- assert( Custodian::TestFactory.create( 'ftp://example.com/ must run rsync on 333.' ) )
- assert( Custodian::TestFactory.create( "ftp://example.com/ must run rsync on 3311 otherwise 'xxx'." ) )
+ assert(Custodian::TestFactory.create('example.com must run rsync.'))
+ assert(Custodian::TestFactory.create('ftp://example.com/ must run rsync.'))
+ assert(Custodian::TestFactory.create('ftp://example.com/ must run rsync on 333.'))
+ assert(Custodian::TestFactory.create("ftp://example.com/ must run rsync on 3311 otherwise 'xxx'."))
end
- assert( Custodian::TestFactory.create( 'rsync.example.com must run rsync.' )[0].target ==
- 'rsync.example.com' )
- assert( Custodian::TestFactory.create( 'rsync://rsync.example.com/ must run rsync.' )[0].target ==
- 'rsync.example.com' )
+ assert(Custodian::TestFactory.create('rsync.example.com must run rsync.')[0].target ==
+ 'rsync.example.com')
+ assert(Custodian::TestFactory.create('rsync://rsync.example.com/ must run rsync.')[0].target ==
+ 'rsync.example.com')
#
@@ -152,11 +152,11 @@ class TestTestFactory < Test::Unit::TestCase
data.each do |str,prt|
assert_nothing_raised do
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
- assert( obj.kind_of? Array )
- assert( ! obj.empty? )
- assert( obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.")
+ assert(obj.kind_of? Array)
+ assert(! obj.empty?)
+ assert(obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.")
end
end
end
@@ -170,28 +170,28 @@ class TestTestFactory < Test::Unit::TestCase
def test_dns_handler
assert_nothing_raised do
- assert( Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving NS as '80.68.80.26;85.17.170.78;80.68.80.27'." ) )
+ assert(Custodian::TestFactory.create("a.ns.bytemark.co.uk must run dns for bytemark.co.uk resolving NS as '80.68.80.26;85.17.170.78;80.68.80.27'."))
end
#
# Missing record-type
#
assert_raise ArgumentError do
- Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns for bytemark.co.uk as '80.68.80.26;85.17.170.78;80.68.80.27'." )
+ Custodian::TestFactory.create("a.ns.bytemark.co.uk must run dns for bytemark.co.uk as '80.68.80.26;85.17.170.78;80.68.80.27'.")
end
#
# Missing target
#
assert_raise ArgumentError do
- assert( Custodian::TestFactory.create( "a.ns.bytemark.co.uk must run dns resolving NS as '80.68.80.26;85.17.170.78;80.68.80.27'." ) )
+ assert(Custodian::TestFactory.create("a.ns.bytemark.co.uk must run dns resolving NS as '80.68.80.26;85.17.170.78;80.68.80.27'."))
end
#
# Missing expected results
#
assert_raise ArgumentError do
- assert( Custodian::TestFactory.create( 'a.ns.bytemark.co.uk must run dns for www.bytemark.co.uk resolving NS ' ) )
+ assert(Custodian::TestFactory.create('a.ns.bytemark.co.uk must run dns for www.bytemark.co.uk resolving NS '))
end
end
@@ -205,9 +205,9 @@ class TestTestFactory < Test::Unit::TestCase
assert_nothing_raised do
- assert( Custodian::TestFactory.create( 'example.com must not run rsync.' ) )
- assert( Custodian::TestFactory.create( 'ftp://example.com/ must not run rsync.' ) )
- assert( Custodian::TestFactory.create( 'ftp://example.com/ must not run rsync on 333.' ) )
+ assert(Custodian::TestFactory.create('example.com must not run rsync.'))
+ assert(Custodian::TestFactory.create('ftp://example.com/ must not run rsync.'))
+ assert(Custodian::TestFactory.create('ftp://example.com/ must not run rsync on 333.'))
end
@@ -228,16 +228,16 @@ class TestTestFactory < Test::Unit::TestCase
data.each do |str,inv|
assert_nothing_raised do
- obj = Custodian::TestFactory.create( str )
+ obj = Custodian::TestFactory.create(str)
- assert( obj.kind_of? Array )
- assert( ! obj.empty? )
+ assert(obj.kind_of? Array)
+ assert(! obj.empty?)
#
# Ensure we got the object, and the port was correct.
#
assert(obj, "created object via TestFactory.create('#{str}')")
- assert( obj[0].inverted == inv, "#{str} -> #{inv}" )
+ assert(obj[0].inverted == inv, "#{str} -> #{inv}")
end
end
@@ -269,14 +269,14 @@ class TestTestFactory < Test::Unit::TestCase
assert_nothing_raised do
- test_one_obj = Custodian::TestFactory.create( test_one )
- assert( !test_one_obj[0].inverted )
+ test_one_obj = Custodian::TestFactory.create(test_one)
+ assert(!test_one_obj[0].inverted)
- test_two_obj = Custodian::TestFactory.create( test_two )
- assert( test_two_obj[0].inverted, "Found inverted test for #{tst}" )
+ test_two_obj = Custodian::TestFactory.create(test_two)
+ assert(test_two_obj[0].inverted, "Found inverted test for #{tst}")
- assert_equal( tst, test_one_obj[0].get_type )
- assert_equal( tst, test_two_obj[0].get_type )
+ assert_equal(tst, test_one_obj[0].get_type)
+ assert_equal(tst, test_two_obj[0].get_type)
end
end
end
@@ -292,21 +292,21 @@ class TestTestFactory < Test::Unit::TestCase
a = []
- 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.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 )
+ obj = Custodian::TestFactory.create(entry)
assert(obj)
- assert( obj.kind_of? Array )
- assert( ! obj.empty? )
- assert_equal( 'test.host.example.com', obj[0].target )
+ assert(obj.kind_of? Array)
+ assert(! obj.empty?)
+ assert_equal('test.host.example.com', obj[0].target)
end
end
end
diff --git a/t/test-custodian-util-bytemark.rb b/t/test-custodian-util-bytemark.rb
index 30bb480..3b17f4f 100755
--- a/t/test-custodian-util-bytemark.rb
+++ b/t/test-custodian-util-bytemark.rb
@@ -53,9 +53,9 @@ class TestBytemarkUtil < Test::Unit::TestCase
to_test.each do |name,inside|
if inside
- assert( Custodian::Util::Bytemark.inside?( name ) == true )
+ assert(Custodian::Util::Bytemark.inside?(name) == true)
else
- assert( Custodian::Util::Bytemark.inside?( name ) == false )
+ assert(Custodian::Util::Bytemark.inside?(name) == false)
end
end
diff --git a/t/test-custodian-util-dns.rb b/t/test-custodian-util-dns.rb
index 2582d94..399639b 100755
--- a/t/test-custodian-util-dns.rb
+++ b/t/test-custodian-util-dns.rb
@@ -30,27 +30,27 @@ class TestDNSUtil < Test::Unit::TestCase
#
def test_lookup
- details = Custodian::Util::DNS.hostname_to_ip( 'bytemark.co.uk' )
- assert( ( details == '2001:41c9:0:1019:81::80' ) ||
- ( details == '80.68.81.80' ) )
+ details = Custodian::Util::DNS.hostname_to_ip('bytemark.co.uk')
+ assert((details == '2001:41c9:0:1019:81::80') ||
+ (details == '80.68.81.80'))
- details = Custodian::Util::DNS.hostname_to_ip( 'www.bytemark.co.uk' )
- assert( ( details == '2001:41c9:0:1019:81::80' ) ||
- ( details == '80.68.81.80' ) )
+ details = Custodian::Util::DNS.hostname_to_ip('www.bytemark.co.uk')
+ assert((details == '2001:41c9:0:1019:81::80') ||
+ (details == '80.68.81.80'))
- details = Custodian::Util::DNS.hostname_to_ip( 'ipv4.steve.org.uk' )
- assert( details == '80.68.84.103' )
+ details = Custodian::Util::DNS.hostname_to_ip('ipv4.steve.org.uk')
+ assert(details == '80.68.84.103')
- details = Custodian::Util::DNS.hostname_to_ip( 'ipv6.steve.org.uk' )
- assert( details == '2001:41c8:10b:103::10' )
+ details = Custodian::Util::DNS.hostname_to_ip('ipv6.steve.org.uk')
+ assert(details == '2001:41c8:10b:103::10')
#
# Failure case
#
- details = Custodian::Util::DNS.hostname_to_ip( 'this.doesnot.exist' )
- assert( details.nil? )
+ details = Custodian::Util::DNS.hostname_to_ip('this.doesnot.exist')
+ assert(details.nil?)
end
@@ -63,20 +63,20 @@ class TestDNSUtil < Test::Unit::TestCase
#
# IPv6 lookup
#
- details = Custodian::Util::DNS.ip_to_hostname( '2001:41c9:0:1019:81::80' )
- assert( details =~ /bytemark(-?hosting)?\.(com|eu|co\.uk)$/i )
+ details = Custodian::Util::DNS.ip_to_hostname('2001:41c9:0:1019:81::80')
+ assert(details =~ /bytemark(-?hosting)?\.(com|eu|co\.uk)$/i)
#
# IPv4 lookup
#
- details = Custodian::Util::DNS.ip_to_hostname( '80.68.81.80' )
- assert( details =~ /bytemark(-?hosting)?\.(com|eu|co\.uk)$/i )
+ details = Custodian::Util::DNS.ip_to_hostname('80.68.81.80')
+ assert(details =~ /bytemark(-?hosting)?\.(com|eu|co\.uk)$/i)
#
# Bogus lookup - should return nil.
#
- details = Custodian::Util::DNS.ip_to_hostname( '800.683.853.348' )
- assert( details.nil? )
+ details = Custodian::Util::DNS.ip_to_hostname('800.683.853.348')
+ assert(details.nil?)
end
end
diff --git a/t/test-custodian-util-ping.rb b/t/test-custodian-util-ping.rb
index e01ef8d..8de1cd5 100755
--- a/t/test-custodian-util-ping.rb
+++ b/t/test-custodian-util-ping.rb
@@ -41,7 +41,7 @@ class TestPingUtil < Test::Unit::TestCase
# A hostname must be supplied
#
assert_raise ArgumentError do
- Custodian::Util::Ping.new( nil )
+ Custodian::Util::Ping.new(nil)
end
@@ -49,10 +49,10 @@ class TestPingUtil < Test::Unit::TestCase
# A hostname is a string, not an array, hash, or similar.
#
assert_raise ArgumentError do
- Custodian::Util::Ping.new( {})
+ Custodian::Util::Ping.new({})
end
assert_raise ArgumentError do
- Custodian::Util::Ping.new( [])
+ Custodian::Util::Ping.new([])
end
@@ -64,9 +64,9 @@ class TestPingUtil < Test::Unit::TestCase
#
def test_lookup_ipv4
- helper = Custodian::Util::Ping.new( 'ipv4.steve.org.uk' )
- assert( helper.is_ipv4? )
- assert( ! helper.is_ipv6? )
+ helper = Custodian::Util::Ping.new('ipv4.steve.org.uk')
+ assert(helper.is_ipv4?)
+ assert(! helper.is_ipv6?)
end
@@ -76,9 +76,9 @@ class TestPingUtil < Test::Unit::TestCase
#
def test_lookup_ipv6
- helper = Custodian::Util::Ping.new( 'ipv6.steve.org.uk' )
- assert( helper.is_ipv6? )
- assert( ! helper.is_ipv4? )
+ helper = Custodian::Util::Ping.new('ipv6.steve.org.uk')
+ assert(helper.is_ipv6?)
+ assert(! helper.is_ipv4?)
end
@@ -88,10 +88,10 @@ class TestPingUtil < Test::Unit::TestCase
def test_lookup_fail
%w( tessf.dfsdf.sdf.sdfsdf fdsfkljflj3.fdsfds.f3.dfs ).each do |name|
assert_nothing_raised do
- helper = Custodian::Util::Ping.new( name )
+ helper = Custodian::Util::Ping.new(name)
- assert( ! helper.is_ipv4? )
- assert( ! helper.is_ipv6? )
+ assert(! helper.is_ipv4?)
+ assert(! helper.is_ipv6?)
end
end
diff --git a/t/test-custodian-util-timespan.rb b/t/test-custodian-util-timespan.rb
index 210a532..89dfbcd 100755
--- a/t/test-custodian-util-timespan.rb
+++ b/t/test-custodian-util-timespan.rb
@@ -29,37 +29,37 @@ class TestTimeSpanUtil < Test::Unit::TestCase
def test_to_hour
for hour in 0..23
- assert_equal( hour, Custodian::Util::TimeSpan.to_hour(hour))
+ assert_equal(hour, Custodian::Util::TimeSpan.to_hour(hour))
end
#
# Invalid hours will throw exceptions
#
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.to_hour( 0.5 )
+ result = Custodian::Util::TimeSpan.to_hour(0.5)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.to_hour( -1 )
+ result = Custodian::Util::TimeSpan.to_hour(-1)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.to_hour( 100 )
+ result = Custodian::Util::TimeSpan.to_hour(100)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.to_hour( 24 )
+ result = Custodian::Util::TimeSpan.to_hour(24)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.to_hour( 25 )
+ result = Custodian::Util::TimeSpan.to_hour(25)
end
#
# Ensure AM times work well
#
for hour in 0..11
- assert_equal( hour, Custodian::Util::TimeSpan.to_hour( "#{hour}am"))
+ assert_equal(hour, Custodian::Util::TimeSpan.to_hour("#{hour}am"))
end
for hour in 0..11
- assert_equal( 12 +hour, Custodian::Util::TimeSpan.to_hour( "#{hour}pm"))
+ assert_equal(12 +hour, Custodian::Util::TimeSpan.to_hour("#{hour}pm"))
end
end
@@ -76,15 +76,15 @@ class TestTimeSpanUtil < Test::Unit::TestCase
#
for i in 24..100
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.inside?( i, 2 )
+ result = Custodian::Util::TimeSpan.inside?(i, 2)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.inside?( 1, i )
+ result = Custodian::Util::TimeSpan.inside?(1, i)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.inside?( 1, 2, i )
+ result = Custodian::Util::TimeSpan.inside?(1, 2, i)
end
end
@@ -94,15 +94,15 @@ class TestTimeSpanUtil < Test::Unit::TestCase
for i in 1..50
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.inside?( 1, ( -1 * i ) )
+ result = Custodian::Util::TimeSpan.inside?(1, (-1 * i))
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.inside?( ( -1 * i ), 1 )
+ result = Custodian::Util::TimeSpan.inside?((-1 * i), 1)
end
assert_raise ArgumentError do
- result = Custodian::Util::TimeSpan.inside?( 1, 1, ( -1 * i ) )
+ result = Custodian::Util::TimeSpan.inside?(1, 1, (-1 * i))
end
end
@@ -114,8 +114,8 @@ class TestTimeSpanUtil < Test::Unit::TestCase
#
def test_simple_cases
# 8am-5pm
- assert(Custodian::Util::TimeSpan.inside?( '8am', '5am', 12 ))
- assert(Custodian::Util::TimeSpan.inside?( 8, 17, 12 ))
+ assert(Custodian::Util::TimeSpan.inside?('8am', '5am', 12))
+ assert(Custodian::Util::TimeSpan.inside?(8, 17, 12))
end
@@ -125,25 +125,25 @@ class TestTimeSpanUtil < Test::Unit::TestCase
def test_midnight_cases
# 9pm-2am
- assert(Custodian::Util::TimeSpan.inside?( '9pm', '2am', 22 ))
- assert(Custodian::Util::TimeSpan.inside?( '9pm', '2am', '10pm' ))
- assert(Custodian::Util::TimeSpan.inside?( 21, 2, 22 ))
- assert(Custodian::Util::TimeSpan.inside?( 21, 2, '10pm' ))
+ assert(Custodian::Util::TimeSpan.inside?('9pm', '2am', 22))
+ assert(Custodian::Util::TimeSpan.inside?('9pm', '2am', '10pm'))
+ assert(Custodian::Util::TimeSpan.inside?(21, 2, 22))
+ assert(Custodian::Util::TimeSpan.inside?(21, 2, '10pm'))
# 10pm-3am
- assert(Custodian::Util::TimeSpan.inside?( '10pm', '3am', 22 ))
- assert(Custodian::Util::TimeSpan.inside?( 22, 3, 22 ))
- assert(Custodian::Util::TimeSpan.inside?( 22, 3, 22 ))
- assert(Custodian::Util::TimeSpan.inside?( 22, 3, '10pm' ))
+ assert(Custodian::Util::TimeSpan.inside?('10pm', '3am', 22))
+ assert(Custodian::Util::TimeSpan.inside?(22, 3, 22))
+ assert(Custodian::Util::TimeSpan.inside?(22, 3, 22))
+ assert(Custodian::Util::TimeSpan.inside?(22, 3, '10pm'))
# 11pm-5am
- assert(Custodian::Util::TimeSpan.inside?( '11pm', '5am', 23 ))
- assert(Custodian::Util::TimeSpan.inside?( 23, 5, 23 ))
- assert(Custodian::Util::TimeSpan.inside?( '11pm', '5am', '11pm' ))
+ assert(Custodian::Util::TimeSpan.inside?('11pm', '5am', 23))
+ assert(Custodian::Util::TimeSpan.inside?(23, 5, 23))
+ assert(Custodian::Util::TimeSpan.inside?('11pm', '5am', '11pm'))
# midnight-3am
- assert( Custodian::Util::TimeSpan.inside?( '0', '3am', 1 ))
- assert( Custodian::Util::TimeSpan.inside?( '0', '3am', '1am' ))
+ assert(Custodian::Util::TimeSpan.inside?('0', '3am', 1))
+ assert(Custodian::Util::TimeSpan.inside?('0', '3am', '1am'))
end
@@ -158,38 +158,38 @@ class TestTimeSpanUtil < Test::Unit::TestCase
close = '6pm'
# The hours + the middle should be inside
- assert( Custodian::Util::TimeSpan.inside?( open, close, 16 ) )
- assert( Custodian::Util::TimeSpan.inside?( open, close, '4pm' ) )
+ assert(Custodian::Util::TimeSpan.inside?(open, close, 16))
+ assert(Custodian::Util::TimeSpan.inside?(open, close, '4pm'))
- assert( Custodian::Util::TimeSpan.inside?( open, close, 17 ) )
- assert( Custodian::Util::TimeSpan.inside?( open, close, '5pm' ) )
+ assert(Custodian::Util::TimeSpan.inside?(open, close, 17))
+ assert(Custodian::Util::TimeSpan.inside?(open, close, '5pm'))
- assert( Custodian::Util::TimeSpan.inside?( open, close, 18 ) )
- assert( Custodian::Util::TimeSpan.inside?( open, close, '6pm' ) )
+ assert(Custodian::Util::TimeSpan.inside?(open, close, 18))
+ assert(Custodian::Util::TimeSpan.inside?(open, close, '6pm'))
#
# The preceeding + successive hours shouldn't be.
#
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, 15 ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, 19 ) )
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, 15))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, 19))
#
# That is true for the string-versions too
#
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, '3pm' ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, '7pm' ) )
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, '3pm'))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, '7pm'))
#
# Random hours should be outside too.
#
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, 3 ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, '3am' ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, 7 ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, '7am' ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, 9 ) )
- assert( ! Custodian::Util::TimeSpan.inside?( open, close, '9am' ) )
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, 3))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, '3am'))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, 7))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, '7am'))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, 9))
+ assert(! Custodian::Util::TimeSpan.inside?(open, close, '9am'))
end
@@ -202,7 +202,7 @@ class TestTimeSpanUtil < Test::Unit::TestCase
#
def test_worst
for i in 0..23
- assert( Custodian::Util::TimeSpan.inside?( 0, 23, i ) )
+ assert(Custodian::Util::TimeSpan.inside?(0, 23, i))
end
end
@@ -215,14 +215,14 @@ class TestTimeSpanUtil < Test::Unit::TestCase
def test_wrap_around
for h in 00..23
- assert_equal( 1, Custodian::Util::TimeSpan.to_hours( h,h ).size )
+ assert_equal(1, Custodian::Util::TimeSpan.to_hours(h,h).size)
end
#
# But the time-period 00-23 is a full day
#
- assert_equal( 24,
- Custodian::Util::TimeSpan.to_hours( 0,23 ).size )
+ assert_equal(24,
+ Custodian::Util::TimeSpan.to_hours(0,23).size)
end
diff --git a/t/test-http-vs-https.rb b/t/test-http-vs-https.rb
index ab44ffc..8843683 100755
--- a/t/test-http-vs-https.rb
+++ b/t/test-http-vs-https.rb
@@ -42,13 +42,13 @@ class TestTestName < Test::Unit::TestCase
test = nil
assert_nothing_raised do
- test = Custodian::TestFactory.create( 'http://example.com/ must run http.' )
+ test = Custodian::TestFactory.create('http://example.com/ must run http.')
end
- assert( test )
- assert( test.kind_of? Array )
- assert( ! test.empty? )
- assert_equal( test[0].get_type, 'http' )
+ assert(test)
+ assert(test.kind_of? Array)
+ assert(! test.empty?)
+ assert_equal(test[0].get_type, 'http')
end
@@ -59,13 +59,13 @@ class TestTestName < Test::Unit::TestCase
test = nil
assert_nothing_raised do
- test = Custodian::TestFactory.create( 'https://example.com/ must run https.' )
+ test = Custodian::TestFactory.create('https://example.com/ must run https.')
end
- assert( test )
- assert( test.kind_of? Array )
- assert( ! test.empty? )
- assert_equal( test[0].get_type, 'https' )
+ assert(test)
+ assert(test.kind_of? Array)
+ assert(! test.empty?)
+ assert_equal(test[0].get_type, 'https')
end
@@ -76,19 +76,19 @@ class TestTestName < Test::Unit::TestCase
assert_raise ArgumentError do
- Custodian::TestFactory.create( 'https://example.com/ must run http.' )
+ Custodian::TestFactory.create('https://example.com/ must run http.')
end
assert_raise ArgumentError do
- Custodian::TestFactory.create( 'http://example.com/ must run https.' )
+ Custodian::TestFactory.create('http://example.com/ must run https.')
end
assert_nothing_raised do
- Custodian::TestFactory.create( 'http://example.com/ must run http.' )
+ Custodian::TestFactory.create('http://example.com/ must run http.')
end
assert_nothing_raised do
- Custodian::TestFactory.create( 'https://example.com/ must run https.' )
+ Custodian::TestFactory.create('https://example.com/ must run https.')
end
end
diff --git a/t/test-ldap-probe.rb b/t/test-ldap-probe.rb
index 63e95a3..70b616b 100755
--- a/t/test-ldap-probe.rb
+++ b/t/test-ldap-probe.rb
@@ -29,12 +29,12 @@ class TestLDAPProbe < Test::Unit::TestCase
test = nil
assert_nothing_raised do
- test = Custodian::TestFactory.create( "auth.bytemark.co.uk must run ldap on 389 with username 'testing' with password 'bob' otherwise 'LDAP dead?'." )
+ test = Custodian::TestFactory.create("auth.bytemark.co.uk must run ldap on 389 with username 'testing' with password 'bob' otherwise 'LDAP dead?'.")
end
- assert( test.kind_of? Array )
- assert( ! test.empty? )
- assert_equal( test[0].get_type, 'ldap' )
+ assert(test.kind_of? Array)
+ assert(! test.empty?)
+ assert_equal(test[0].get_type, 'ldap')
end
@@ -57,10 +57,10 @@ class TestLDAPProbe < Test::Unit::TestCase
#
data.each do |str|
assert_raise ArgumentError do
- test = Custodian::TestFactory.create( str )
+ test = Custodian::TestFactory.create(str)
- assert( test.kind_of? Array )
- assert( ! test.empty? )
+ assert(test.kind_of? Array)
+ assert(! test.empty?)
end
end