Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a command line option to specify the queue host, to allow coordin…

…ation between slaves and the master via a redis server that both can see.
  • Loading branch information...
commit bc7aacd4d5a5addc9059c37264a57629c9394cd2 1 parent 160ed95
@lukemelia lukemelia authored
View
1  features/distributed_run.feature
@@ -16,6 +16,7 @@ Feature: Distributed runs
Scenario: Distribute runs (using named host)
Given Testjour is configured to run on this machine in a temp1 directory
And Testjour is configured to run on this machine in a temp2 directory
+ And Testjour is configured to use this machine as the queue host
When I run `testjour sleep1.feature sleep2.feature`
Then it should fail with "2 steps passed"
And the output should contain "FAIL"
View
8 features/step_definitions/testjour_steps.rb
@@ -19,6 +19,11 @@
FileUtils.mkdir_p full_path
end
+Given /^Testjour is configured to use this machine as the queue host$/ do
+ @args ||= []
+ @args << "--queue-host=#{Socket.gethostname}"
+end
+
Given /^a file testjour_preload.rb at the root of the project that logs "Hello, world"$/ do
File.open(File.join(@full_dir, 'testjour_preload.rb'), 'w') do |file|
file.puts "Testjour.logger.info 'Hello, world'"
@@ -32,9 +37,10 @@
Dir.chdir(@full_dir) do
testjour_path = File.expand_path(File.dirname(__FILE__) + "/../../../../bin/testjour")
cmd = "#{testjour_path} #{@args.join(" ")}"
- #puts cmd
+ # puts cmd
status, @stdout, @stderr = systemu(cmd)
@exit_code = status.exitstatus
+ # puts @stderr.to_s
end
end
View
6 lib/testjour/configuration.rb
@@ -33,7 +33,7 @@ def rsync_uri
end
def queue_host
- @queue_host || Testjour.socket_hostname
+ @queue_host || @options[:queue_host] || Testjour.socket_hostname
end
def remote_slaves
@@ -172,6 +172,10 @@ def option_parser
@options[:create_mysql_db] = true
end
+ opts.on("--queue-host=QUEUE_HOST", "Use another server to host the main redis queue") do |queue_host|
+ @options[:queue_host] = queue_host
+ end
+
opts.on("--max-local-slaves=MAX", "Maximum number of local slaves") do |max|
@options[:max_local_slaves] = max.to_i
end
View
1  spec/fixtures/testjour_preload.rb
@@ -1 +0,0 @@
-Testjour.logger.info 'Hello, world'
Please sign in to comment.
Something went wrong with that request. Please try again.