Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add queue-timeout configuration option to specify the length of time …

…the testjour master will wait for results to be posted to the queue before giving up.
  • Loading branch information...
commit 28212efdead7844cafdfc32f7863752a97014875 1 parent 69698d9
@lukemelia lukemelia authored
View
13 lib/testjour/commands/run.rb
@@ -21,7 +21,10 @@ def execute
configuration.setup
if configuration.feature_files.any?
- RedisQueue.new(configuration.queue_host, configuration.queue_prefix).reset_all
+ RedisQueue.new(configuration.queue_host,
+ configuration.queue_prefix,
+ configuration.queue_timeout).reset_all
+
queue_features
@started_slaves = 0
@@ -38,7 +41,9 @@ def execute
def queue_features
Testjour.logger.info("Queuing features...")
- queue = RedisQueue.new(configuration.queue_host, configuration.queue_prefix)
+ queue = RedisQueue.new(configuration.queue_host,
+ configuration.queue_prefix,
+ configuration.queue_timeout)
configuration.feature_files.each do |feature_file|
queue.push(:feature_files, feature_file)
@@ -88,7 +93,9 @@ def start_slave
def print_results
results_formatter = ResultsFormatter.new(step_counter, configuration.options)
- queue = RedisQueue.new(configuration.queue_host, configuration.queue_prefix)
+ queue = RedisQueue.new(configuration.queue_host,
+ configuration.queue_prefix,
+ configuration.queue_timeout)
step_counter.count.times do
results_formatter.result(queue.blocking_pop(:results))
View
4 lib/testjour/commands/run_slave.rb
@@ -49,7 +49,9 @@ def before_require
end
def work
- queue = RedisQueue.new(configuration.queue_host, configuration.queue_prefix)
+ queue = RedisQueue.new(configuration.queue_host,
+ configuration.queue_prefix,
+ configuration.queue_timeout)
feature_file = true
while feature_file
View
18 lib/testjour/configuration.rb
@@ -19,7 +19,7 @@ def language_incomplete?
# Cucumber.load_language("en")
step_mother.options = cucumber_configuration.options
end
-
+
def max_local_slaves
@options[:max_local_slaves] || 2
end
@@ -31,7 +31,7 @@ def in
def rsync_uri
external_rsync_uri || "#{full_uri.user}#{'@' if full_uri.user}#{full_uri.host}:#{full_uri.path}"
end
-
+
def external_rsync_uri
@options[:rsync_uri]
end
@@ -39,10 +39,14 @@ def external_rsync_uri
def queue_host
@queue_host || @options[:queue_host] || Testjour.socket_hostname
end
-
+
def queue_prefix
@options[:queue_prefix] || 'default'
end
+
+ def queue_timeout
+ @options[:queue_timeout].to_i || 270
+ end
def remote_slaves
@options[:slaves] || []
@@ -119,7 +123,7 @@ def unshift_args(pushed_args)
@args.unshift(pushed_arg)
end
end
-
+
def load_additional_args_from_external_file
args_from_file = begin
if File.exist?(args_file)
@@ -130,7 +134,7 @@ def load_additional_args_from_external_file
end
unshift_args(args_from_file)
end
-
+
def args_file
# We need to know about this CLI option prior to OptParse's parse
args_file_option = @args.detect{|arg| arg =~ /^--testjour-config=/}
@@ -220,6 +224,10 @@ def option_parser
@options[:queue_prefix] = queue_prefix
end
+ opts.on("--queue-timeout=QUEUE_TIMEOUT", "How long to wait for results to appear in the queue before giving up") do |queue_timeout|
+ @options[:queue_timeout] = queue_timeout
+ end
+
opts.on("--rsync-uri=RSYNC_URI", "Use another location to host the codebase for slave rsync (master will rsync to this URI first)") do |rsync_uri|
@options[:rsync_uri] = rsync_uri
end
View
4 lib/testjour/cucumber_extensions/http_formatter.rb
@@ -43,7 +43,9 @@ def table_cell_value(value, status)
private
def progress(time, status, step_match = nil, exception = nil)
- queue = RedisQueue.new(@configuration.queue_host, @configuration.queue_prefix)
+ queue = RedisQueue.new(@configuration.queue_host,
+ @configuration.queue_prefix,
+ @configuration.queue_timeout)
queue.push(:results, Result.new(time, status, step_match, exception))
end
View
5 lib/testjour/redis_queue.rb
@@ -5,9 +5,10 @@ module Testjour
class RedisQueue
- def initialize(redis_host, queue_namespace)
+ def initialize(redis_host, queue_namespace, queue_timeout)
@redis = Redis.new(:db => 11, :host => redis_host)
@queue_namespace = queue_namespace
+ @queue_timeout = queue_timeout
end
attr_reader :redis
@@ -22,7 +23,7 @@ def pop(queue_name)
end
def blocking_pop(queue_name)
- Timeout.timeout(180) do
+ Timeout.timeout(@queue_timeout) do
result = nil
while result.nil?
Please sign in to comment.
Something went wrong with that request. Please try again.