summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-03-09 13:09:46 +0000
committerSteve Kemp <steve@steve.org.uk>2015-03-09 13:09:46 +0000
commitedf0e675123e4869e2739d1bab0ed57b3b9f664c (patch)
treec0771fecb0734fb342cf16e352f19fd3ead9a112
parent22b40326730fb7a4a8e2f5cb8d877f6a84494d02 (diff)
Do not use parentheses for method calls with no arguments.
This is neater. Flagged by rubocop
-rwxr-xr-xbin/custodian-dequeue6
-rwxr-xr-xbin/custodian-enqueue8
-rwxr-xr-xbin/custodian-queue6
-rwxr-xr-xbin/multi-ping2
-rw-r--r--lib/custodian/alerts/file.rb2
-rw-r--r--lib/custodian/alerts/graphite.rb4
-rw-r--r--lib/custodian/alerts/mauve.rb8
-rw-r--r--lib/custodian/alerts/redis-state.rb2
-rw-r--r--lib/custodian/alerts/smtp.rb4
-rw-r--r--lib/custodian/parser.rb2
-rw-r--r--lib/custodian/protocoltest/dns.rb12
-rw-r--r--lib/custodian/protocoltest/http.rb4
-rw-r--r--lib/custodian/protocoltest/mx.rb4
-rw-r--r--lib/custodian/protocoltest/openproxy.rb6
-rw-r--r--lib/custodian/protocoltest/ping.rb4
-rw-r--r--lib/custodian/protocoltest/smtprelay.rb2
-rw-r--r--lib/custodian/protocoltest/tcp.rb10
-rw-r--r--lib/custodian/queue.rb2
-rw-r--r--lib/custodian/settings.rb18
-rw-r--r--lib/custodian/util/dns.rb8
-rw-r--r--lib/custodian/worker.rb18
-rwxr-xr-xt/test-custodian-parser.rb32
-rwxr-xr-xt/test-custodian-settings.rb12
-rwxr-xr-xt/test-custodian-testfactory.rb24
-rwxr-xr-xt/test-custodian-util-timespan.rb4
25 files changed, 102 insertions, 102 deletions
diff --git a/bin/custodian-dequeue b/bin/custodian-dequeue
index c5c5309..a411746 100755
--- a/bin/custodian-dequeue
+++ b/bin/custodian-dequeue
@@ -65,7 +65,7 @@ if __FILE__ == $PROGRAM_NAME then
#
# The settings object contains a lot of configuration-data.
#
- settings = Custodian::Settings.instance()
+ settings = Custodian::Settings.instance
begin
opts = GetoptLong.new(
@@ -137,7 +137,7 @@ if __FILE__ == $PROGRAM_NAME then
# Single step?
#
if ( ENV['SINGLE'] )
- worker.process_single_job()
+ worker.process_single_job
exit(0)
end
@@ -145,7 +145,7 @@ if __FILE__ == $PROGRAM_NAME then
# Run until we see a failure?
#
if ( ENV['FAIL'] )
- worker.process_until_fail()
+ worker.process_until_fail
exit(0)
end
diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue
index dec83cb..568c0d6 100755
--- a/bin/custodian-enqueue
+++ b/bin/custodian-enqueue
@@ -129,10 +129,10 @@ if __FILE__ == $PROGRAM_NAME then
#
# Connected to the queue - be it redis or beanstalkd
#
- settings = Custodian::Settings.instance()
- queue = Custodian::QueueType.create( settings.queue_type() )
+ settings = Custodian::Settings.instance
+ queue = Custodian::QueueType.create( settings.queue_type )
if ( ! queue )
- puts "Failed to connect to the #{settings.queue_type()} queue"
+ puts "Failed to connect to the #{settings.queue_type} queue"
exit 1
end
@@ -140,7 +140,7 @@ if __FILE__ == $PROGRAM_NAME then
#
# Create the parser object.
#
- mon = Custodian::Parser.new()
+ mon = Custodian::Parser.new
#
diff --git a/bin/custodian-queue b/bin/custodian-queue
index 48c6edc..9dec58a 100755
--- a/bin/custodian-queue
+++ b/bin/custodian-queue
@@ -124,8 +124,8 @@ if __FILE__ == $PROGRAM_NAME then
#
# Create the queue object.
#
- settings = Custodian::Settings.instance()
- queue = Custodian::QueueType.create( settings.queue_type() )
+ settings = Custodian::Settings.instance
+ queue = Custodian::QueueType.create( settings.queue_type )
#
# Alerting on a queue that is too-full?
@@ -149,7 +149,7 @@ if __FILE__ == $PROGRAM_NAME then
# Showing stats?
#
if ( $STATS )
- jobs = queue.size?()
+ jobs = queue.size?
puts "There are #{jobs || 0} jobs pending."
exit( 0 )
end
diff --git a/bin/multi-ping b/bin/multi-ping
index 00ae466..9833215 100755
--- a/bin/multi-ping
+++ b/bin/multi-ping
@@ -121,7 +121,7 @@ helper = Custodian::Util::Ping.new( hostname )
#
# Ping the host, via the helper
#
-if ( helper.run_ping() )
+if ( helper.run_ping )
puts "#{hostname} - #{helper.address} - is alive."
exit 0
else
diff --git a/lib/custodian/alerts/file.rb b/lib/custodian/alerts/file.rb
index cc2a672..5874136 100644
--- a/lib/custodian/alerts/file.rb
+++ b/lib/custodian/alerts/file.rb
@@ -31,7 +31,7 @@ module Custodian
# Record a raise event for the given test.
#
def raise
- write_message( "RAISE: #{test.target} failed #{test.get_type}-test - #{test.error()}" )
+ write_message( "RAISE: #{test.target} failed #{test.get_type}-test - #{test.error}" )
end
diff --git a/lib/custodian/alerts/graphite.rb b/lib/custodian/alerts/graphite.rb
index 34ec73c..2e49125 100644
--- a/lib/custodian/alerts/graphite.rb
+++ b/lib/custodian/alerts/graphite.rb
@@ -63,9 +63,9 @@ module Custodian
#
# Send via UDP.
#
- socket = UDPSocket.new()
+ socket = UDPSocket.new
socket.send( payload, 0, @target, 2003 );
- socket.close()
+ socket.close
end
diff --git a/lib/custodian/alerts/mauve.rb b/lib/custodian/alerts/mauve.rb
index 8ce14c1..dfa4a04 100644
--- a/lib/custodian/alerts/mauve.rb
+++ b/lib/custodian/alerts/mauve.rb
@@ -69,7 +69,7 @@ module Custodian
#
update = Mauve::Proto::AlertUpdate.new
update.alert = []
- update.source = @settings.alert_source()
+ update.source = @settings.alert_source
update.replace = false
#
@@ -151,7 +151,7 @@ module Custodian
#
update = Mauve::Proto::AlertUpdate.new
update.alert = []
- update.source = @settings.alert_source()
+ update.source = @settings.alert_source
update.replace = false
#
@@ -241,7 +241,7 @@ module Custodian
#
# The text from the job-defition
#
- user_text = test.get_notification_text()
+ user_text = test.get_notification_text
#
# Add the user-detail if present
@@ -251,7 +251,7 @@ module Custodian
#
# Add the test-failure message
#
- alert.detail = "#{alert.detail}<p>#{test.error()}</p>"
+ alert.detail = "#{alert.detail}<p>#{test.error}</p>"
#
# Determine if this is inside/outside the bytemark network
diff --git a/lib/custodian/alerts/redis-state.rb b/lib/custodian/alerts/redis-state.rb
index 7d9daa7..f37cef2 100644
--- a/lib/custodian/alerts/redis-state.rb
+++ b/lib/custodian/alerts/redis-state.rb
@@ -59,7 +59,7 @@ module Custodian
tmp["type"] = @test.get_type
tmp["target"] = @test.target
tmp["result"] = "RAISE"
- tmp["reason"] = @test.error()
+ tmp["reason"] = @test.error
tmp["test" ] = @test.to_s
tmp["class" ] = @test.class
diff --git a/lib/custodian/alerts/smtp.rb b/lib/custodian/alerts/smtp.rb
index 4de6fbe..d37701b 100644
--- a/lib/custodian/alerts/smtp.rb
+++ b/lib/custodian/alerts/smtp.rb
@@ -30,8 +30,8 @@ module Custodian
# Raise an alert by email.
#
def raise
- subject = "#{test.target} alert #{test.get_type}-test - #{test.error()}"
- body = "The alert has raised, with the following details:\n#{test.error()}\nRegards\n";
+ subject = "#{test.target} alert #{test.get_type}-test - #{test.error}"
+ body = "The alert has raised, with the following details:\n#{test.error}\nRegards\n";
_send_mail( @target, subject, body )
end
diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb
index 0bafd47..bce507b 100644
--- a/lib/custodian/parser.rb
+++ b/lib/custodian/parser.rb
@@ -139,7 +139,7 @@ module Custodian
text = getURL(uri)
text.split( /[\r\n]/ ).each do |line|
- val.push( line ) if ( line.length() > 0)
+ val.push( line ) if ( line.length > 0)
end
elsif ( line =~ /\s(is|are)\s+(.*)\.+$/ )
diff --git a/lib/custodian/protocoltest/dns.rb b/lib/custodian/protocoltest/dns.rb
index 05c8534..5787881 100644
--- a/lib/custodian/protocoltest/dns.rb
+++ b/lib/custodian/protocoltest/dns.rb
@@ -100,8 +100,8 @@ module Custodian
#
# Get the timeout period.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
#
# Do the lookup
@@ -147,16 +147,16 @@ module Custodian
case ltype
when /^A$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::A).map{ |r| results.push( r.address.to_s() ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::A).map{ |r| results.push( r.address.to_s ) }
when /^AAAA$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::AAAA).map{ |r| results.push( r.address.to_s() ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::AAAA).map{ |r| results.push( r.address.to_s ) }
when /^NS$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::NS).map{ |r| results.push( Resolv.getaddresses( r.name.to_s() ) ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::NS).map{ |r| results.push( Resolv.getaddresses( r.name.to_s ) ) }
when /^MX$/ then
- dns.getresources(name, Resolv::DNS::Resource::IN::MX).map{ |r| results.push( Resolv.getaddresses( r.exchange.to_s() ) ) }
+ dns.getresources(name, Resolv::DNS::Resource::IN::MX).map{ |r| results.push( Resolv.getaddresses( r.exchange.to_s ) ) }
else
@error = "Unknown record type to resolve: '#{ltype}'"
diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb
index 0bbe290..a36b349 100644
--- a/lib/custodian/protocoltest/http.rb
+++ b/lib/custodian/protocoltest/http.rb
@@ -209,8 +209,8 @@ module Custodian
#
# Get the timeout period for this test.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
#
# The URL we'll fetch/poll.
diff --git a/lib/custodian/protocoltest/mx.rb b/lib/custodian/protocoltest/mx.rb
index 29a9183..2372556 100644
--- a/lib/custodian/protocoltest/mx.rb
+++ b/lib/custodian/protocoltest/mx.rb
@@ -57,8 +57,8 @@ module Custodian
#
# Get the timeout period.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
#
# The MX-hosts
diff --git a/lib/custodian/protocoltest/openproxy.rb b/lib/custodian/protocoltest/openproxy.rb
index 5313343..851982c 100644
--- a/lib/custodian/protocoltest/openproxy.rb
+++ b/lib/custodian/protocoltest/openproxy.rb
@@ -80,13 +80,13 @@ module Custodian
#
# Get the timeout period for this test.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
begin
timeout( period ) do
begin
- c = Curl::Easy.new()
+ c = Curl::Easy.new
c.follow_location = true
c.max_redirects = 10
c.ssl_verify_host = false
diff --git a/lib/custodian/protocoltest/ping.rb b/lib/custodian/protocoltest/ping.rb
index ff406d5..423b925 100644
--- a/lib/custodian/protocoltest/ping.rb
+++ b/lib/custodian/protocoltest/ping.rb
@@ -94,8 +94,8 @@ module Custodian
#
# Get the timeout period.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
diff --git a/lib/custodian/protocoltest/smtprelay.rb b/lib/custodian/protocoltest/smtprelay.rb
index a1c0b33..45abf16 100644
--- a/lib/custodian/protocoltest/smtprelay.rb
+++ b/lib/custodian/protocoltest/smtprelay.rb
@@ -86,7 +86,7 @@ module Custodian
begin
- Net::SMTP.start(@host,@port, get_hostname() ) do |smtp|
+ Net::SMTP.start(@host,@port, get_hostname ) do |smtp|
sent = smtp.send_message message, "noreply@bytemark.co.uk", "noreply@bytemark.co.uk"
@status = sent.status.to_s
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb
index 9ca2180..24a05be 100644
--- a/lib/custodian/protocoltest/tcp.rb
+++ b/lib/custodian/protocoltest/tcp.rb
@@ -153,8 +153,8 @@ module Custodian
#
# Get the timeout period.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
#
# Perform the DNS lookups of the specified name.
@@ -265,8 +265,8 @@ module Custodian
#
# Get the timeout period for this test.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
begin
timeout(period) do
@@ -283,7 +283,7 @@ module Custodian
read.gsub!(/[\n\r]/, "")
end
- socket.close()
+ socket.close
if ( banner.nil? )
@error = nil
diff --git a/lib/custodian/queue.rb b/lib/custodian/queue.rb
index 6e252e9..671e44e 100644
--- a/lib/custodian/queue.rb
+++ b/lib/custodian/queue.rb
@@ -182,7 +182,7 @@ end
# Get the size of the queue
#
def size?
- stats = @queue.stats()
+ stats = @queue.stats
( stats['current-jobs-ready'] || 0 )
end
diff --git a/lib/custodian/settings.rb b/lib/custodian/settings.rb
index 8bcf71c..e0d2d27 100644
--- a/lib/custodian/settings.rb
+++ b/lib/custodian/settings.rb
@@ -84,7 +84,7 @@ module Custodian
# Retrieve an arbitrary key
#
def key( name )
- _load() unless( _loaded? )
+ _load unless( _loaded? )
@settings[name]
end
@@ -93,7 +93,7 @@ module Custodian
# The timeout period for each individual test.
#
def timeout
- _load() unless( _loaded? )
+ _load unless( _loaded? )
if ( @settings['timeout'] )
@settings['timeout'].to_i
@@ -109,7 +109,7 @@ module Custodian
# before raising an alert.
#
def retries
- _load() unless( _loaded? )
+ _load unless( _loaded? )
if ( @settings['retries'] )
@settings['retries'].to_i
@@ -129,7 +129,7 @@ module Custodian
# A delay of zero is permissable.
#
def retry_delay
- _load() unless( _loaded? )
+ _load unless( _loaded? )
if ( @settings['retry_delay'] )
@settings['retry_delay'].to_i
@@ -146,7 +146,7 @@ module Custodian
# environmental variable 'QUEUE_ADDRESS'.
#
def queue_type
- _load() unless( _loaded? )
+ _load unless( _loaded? )
@settings['queue_type'] || "redis"
end
@@ -157,7 +157,7 @@ module Custodian
# The filename for the logfile.
#
def log_file
- _load() unless( _loaded? )
+ _load unless( _loaded? )
@settings['log_file'] || "custodian-dequeue.log"
end
@@ -167,7 +167,7 @@ module Custodian
# The alerter to use
#
def alerter
- _load() unless( _loaded? )
+ _load unless( _loaded? )
@settings['alerter'] || "file"
end
@@ -177,7 +177,7 @@ module Custodian
# The alert-source we send. Only used when the notifier is set to mauve.
#
def alert_source
- _load() unless( _loaded? )
+ _load unless( _loaded? )
@settings['alert_source'] || "Custodian"
end
@@ -195,7 +195,7 @@ module Custodian
# When the alerter is "redis" the target is the redis-server address.
#
def alerter_target( alert )
- _load() unless( _loaded? )
+ _load unless( _loaded? )
#
diff --git a/lib/custodian/util/dns.rb b/lib/custodian/util/dns.rb
index 82a7e68..9cbbf59 100644
--- a/lib/custodian/util/dns.rb
+++ b/lib/custodian/util/dns.rb
@@ -26,8 +26,8 @@ module Custodian
#
# Get the timeout period.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
begin
timeout( period ) do
@@ -54,8 +54,8 @@ module Custodian
#
# Get the timeout period.
#
- settings = Custodian::Settings.instance()
- period = settings.timeout()
+ settings = Custodian::Settings.instance
+ period = settings.timeout
begin
timeout( period ) do
diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb
index b411c00..fd1abce 100644
--- a/lib/custodian/worker.rb
+++ b/lib/custodian/worker.rb
@@ -73,16 +73,16 @@ module Custodian
@settings = settings
# Connect to the queue
- @queue = QueueType.create( @settings.queue_type() )
+ @queue = QueueType.create( @settings.queue_type )
# Get the alerter-type(s) to instantiate
@alerter = @settings.alerter
# How many times to repeat a failing test
- @retry_count=@settings.retries()
+ @retry_count=@settings.retries
# Should we sleep between repeated tests?
- @retry_delay = @settings.retry_delay()
+ @retry_delay = @settings.retry_delay
end
@@ -105,7 +105,7 @@ module Custodian
def run!
while( true )
log_message( "Waiting for job.." )
- process_single_job()
+ process_single_job
end
end
@@ -170,7 +170,7 @@ module Custodian
# Run the test - inverting the result if we should
#
result = test.run_test
- result = ! result if ( test.inverted() )
+ result = ! result if ( test.inverted )
if ( result )
log_message( "Test succeeed - clearing alert" )
@@ -223,7 +223,7 @@ module Custodian
#
# Raise the alert, passing the error message.
#
- log_message( "Test failed - alerting with #{test.error()}" )
+ log_message( "Test failed - alerting with #{test.error}" )
do_raise( test )
end
@@ -252,7 +252,7 @@ module Custodian
# give the alerter a reference to the settings object.
alert.set_settings( @settings )
- alert.raise()
+ alert.raise
end
end
@@ -272,7 +272,7 @@ module Custodian
# give the alerter a reference to the settings object.
alert.set_settings( @settings )
- alert.clear()
+ alert.clear
end
end
@@ -300,7 +300,7 @@ module Custodian
# Process jobs until we see a failure, then stop.
#
def process_until_fail
- while( process_single_job() )
+ while( process_single_job )
# nop
end
end
diff --git a/t/test-custodian-parser.rb b/t/test-custodian-parser.rb
index 5822ecd..43a0754 100755
--- a/t/test-custodian-parser.rb
+++ b/t/test-custodian-parser.rb
@@ -44,13 +44,13 @@ class TestCustodianParser < Test::Unit::TestCase
# Constructor
#
assert_nothing_raised do
- Custodian::Parser.new()
+ Custodian::Parser.new
end
end
def test_period
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
result = parser.parse_line( "example.vm.bytemark.co.uk must run ping except between 00-23" )
assert( result.nil? )
end
@@ -69,7 +69,7 @@ class TestCustodianParser < Test::Unit::TestCase
#
# 1. By string.
#
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
# 1.a. Comment lines return nil.
result = parser.parse_line( "# this is a comment" )
@@ -91,7 +91,7 @@ class TestCustodianParser < Test::Unit::TestCase
#
# 2. By array.
#
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
# 2.a. Comment lines return nil.
tmp = []
tmp.push( "# This is a comment.." )
@@ -107,7 +107,7 @@ class TestCustodianParser < Test::Unit::TestCase
#
# 3. By lines
#
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
# 3.a. Comment lines return nil.
str =<<EOF
# This is a comment
@@ -134,7 +134,7 @@ EOF
#
def test_macros_lines
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
#
# Input text
@@ -155,7 +155,7 @@ EOF
#
macros = parser.macros
assert( ! macros.empty? )
- assert( macros.size() == 2 )
+ assert( macros.size == 2 )
end
@@ -166,7 +166,7 @@ EOF
#
def test_macros_array
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
#
# Input text
@@ -186,7 +186,7 @@ EOF
#
macros = parser.macros
assert( ! macros.empty? )
- assert( macros.size() == 2 )
+ assert( macros.size == 2 )
end
@@ -197,7 +197,7 @@ EOF
#
def test_duplicate_macros
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
#
# Input text to parse.
@@ -219,7 +219,7 @@ EOF
#
macros = parser.macros
assert( ! macros.empty? )
- assert( macros.size() == 1 )
+ assert( macros.size == 1 )
end
@@ -233,7 +233,7 @@ EOF
#
# Create a parser - validate it is free of macros.
#
- parser = Custodian::Parser.new()
+ parser = Custodian::Parser.new
macros = parser.macros
assert( macros.empty? )
@@ -248,7 +248,7 @@ EOF
# The difference is the return value will be an array
#
assert( out_txt.kind_of? Array )
- assert( out_txt.size() == 1 )
+ assert( out_txt.size == 1 )
assert( out_txt[0] == in_txt )
@@ -268,7 +268,7 @@ EOF
# The result should be an array
#
assert( ret.kind_of? Array )
- assert_equal( ret.size(), 2 )
+ assert_equal( ret.size, 2 )
assert( ret[0] =~ /example1/)
assert( ret[1] =~ /example2/)
@@ -391,9 +391,9 @@ EOF
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-settings.rb b/t/test-custodian-settings.rb
index 8dea986..0347e7c 100755
--- a/t/test-custodian-settings.rb
+++ b/t/test-custodian-settings.rb
@@ -29,8 +29,8 @@ class TestConfigurationSingleton < Test::Unit::TestCase
# Test that we're genuinely a singleton
#
def test_singleton
- a = Custodian::Settings.instance()
- b = Custodian::Settings.instance()
+ a = Custodian::Settings.instance
+ b = Custodian::Settings.instance
assert( a )
assert( b )
@@ -42,7 +42,7 @@ class TestConfigurationSingleton < Test::Unit::TestCase
# Test that our settings are suitable types
#
def test_types
- settings = Custodian::Settings.instance()
+ settings = Custodian::Settings.instance
# retry delay - probably unset.
@@ -64,18 +64,18 @@ class TestConfigurationSingleton < Test::Unit::TestCase
# timeout - probably unset.
- a = settings.timeout()
+ a = settings.timeout
assert( a.class == Fixnum )
# store a number
settings._store( "timeout", 5 )
- a = settings.timeout()
+ a = settings.timeout
assert( a.class == Fixnum )
assert( a == 5 )
# store a string
settings._store( "timeout", "35" )
- a = settings.timeout()
+ a = settings.timeout
assert( a.class == Fixnum )
assert( a == 35 )
diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb
index 6a115ce..6c71003 100755
--- a/t/test-custodian-testfactory.rb
+++ b/t/test-custodian-testfactory.rb
@@ -52,8 +52,8 @@ class TestTestFactory < Test::Unit::TestCase
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" )
#
@@ -77,7 +77,7 @@ class TestTestFactory < Test::Unit::TestCase
assert( obj.kind_of? Array )
assert( ! obj.empty? )
assert_equal( obj[0].get_type, "ftp" )
- assert_equal( obj[0].port().to_s(), prt )
+ assert_equal( obj[0].port.to_s, prt )
end
end
@@ -109,7 +109,7 @@ class TestTestFactory < Test::Unit::TestCase
assert(obj)
assert( obj.kind_of? Array )
assert( ! obj.empty? )
- assert( obj[0].port().to_s == prt , "'#{str}' gave expected port '#{prt}'.")
+ assert( obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.")
end
end
@@ -130,9 +130,9 @@ class TestTestFactory < Test::Unit::TestCase
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() ==
+ 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() ==
+ assert( Custodian::TestFactory.create( "rsync://rsync.example.com/ must run rsync." )[0].target ==
"rsync.example.com" )
@@ -156,7 +156,7 @@ class TestTestFactory < Test::Unit::TestCase
assert( obj.kind_of? Array )
assert( ! obj.empty? )
- assert( obj[0].port().to_s == prt , "'#{str}' gave expected port '#{prt}'.")
+ assert( obj[0].port.to_s == prt , "'#{str}' gave expected port '#{prt}'.")
end
end
end
@@ -237,7 +237,7 @@ class TestTestFactory < Test::Unit::TestCase
# 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
@@ -247,7 +247,7 @@ class TestTestFactory < Test::Unit::TestCase
# Get all the types we know about.
#
def test_types
- registered = Custodian::TestFactory.known_tests()
+ registered = Custodian::TestFactory.known_tests
# for each test-type
registered.keys.each do |type|
@@ -270,10 +270,10 @@ class TestTestFactory < Test::Unit::TestCase
assert_nothing_raised do
test_one_obj = Custodian::TestFactory.create( test_one )
- assert( !test_one_obj[0].inverted() )
+ 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}" )
+ 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 )
@@ -306,7 +306,7 @@ class TestTestFactory < Test::Unit::TestCase
assert(obj)
assert( obj.kind_of? Array )
assert( ! obj.empty? )
- assert_equal( "test.host.example.com", obj[0].target() )
+ assert_equal( "test.host.example.com", obj[0].target )
end
end
end
diff --git a/t/test-custodian-util-timespan.rb b/t/test-custodian-util-timespan.rb
index ef05fe7..29e9b83 100755
--- a/t/test-custodian-util-timespan.rb
+++ b/t/test-custodian-util-timespan.rb
@@ -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() )
+ Custodian::Util::TimeSpan.to_hours( 0,23 ).size )
end