set an rsync timeout, and trying to get the tests to run

This commit is contained in:
John Bintz 2011-08-23 07:01:48 -04:00
parent ff803d6d3a
commit 94b73ee426
15 changed files with 172 additions and 140 deletions

View File

@ -1,3 +1,4 @@
source :rubygems source :rubygems
gemspec gemspec
gem 'rake', '0.8.7'

View File

@ -1,7 +1,8 @@
PATH PATH
remote: . remote: .
specs: specs:
hydra (0.23.2) hydra (0.23.3)
hydra
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
@ -18,14 +19,15 @@ GEM
json (~> 1.4.6) json (~> 1.4.6)
term-ansicolor (~> 1.0.5) term-ansicolor (~> 1.0.5)
json (1.4.6) json (1.4.6)
rspec (2.0.0.beta.19) rake (0.8.7)
rspec-core (= 2.0.0.beta.19) rspec (2.6.0)
rspec-expectations (= 2.0.0.beta.19) rspec-core (~> 2.6.0)
rspec-mocks (= 2.0.0.beta.19) rspec-expectations (~> 2.6.0)
rspec-core (2.0.0.beta.19) rspec-mocks (~> 2.6.0)
rspec-expectations (2.0.0.beta.19) rspec-core (2.6.4)
diff-lcs (>= 1.1.2) rspec-expectations (2.6.0)
rspec-mocks (2.0.0.beta.19) diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
shoulda (2.10.3) shoulda (2.10.3)
term-ansicolor (1.0.6) term-ansicolor (1.0.6)
therubyracer (0.7.4) therubyracer (0.7.4)
@ -36,6 +38,8 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
cucumber (= 0.9.2) cucumber (= 0.9.2)
hydra! hydra!
rspec (= 2.0.0.beta.19) rake (= 0.8.7)
rspec (~> 2.6.0)
rspec-core (>= 2.6.4)
shoulda (= 2.10.3) shoulda (= 2.10.3)
therubyracer (= 0.7.4) therubyracer (= 0.7.4)

View File

@ -11,7 +11,8 @@ begin
gem.homepage = "http://github.com/ngauthier/hydra" gem.homepage = "http://github.com/ngauthier/hydra"
gem.authors = ["Nick Gauthier"] gem.authors = ["Nick Gauthier"]
gem.add_development_dependency "shoulda", "= 2.10.3" gem.add_development_dependency "shoulda", "= 2.10.3"
gem.add_development_dependency "rspec", "= 2.0.0.beta.19" gem.add_development_dependency "rspec", "~> 2.6.0"
gem.add_development_dependency "rspec-core", ">= 2.6.4"
gem.add_development_dependency "cucumber", "= 0.9.2" gem.add_development_dependency "cucumber", "= 0.9.2"
gem.add_development_dependency "therubyracer", "= 0.7.4" gem.add_development_dependency "therubyracer", "= 0.7.4"
end end
@ -22,7 +23,7 @@ end
require 'rake/testtask' require 'rake/testtask'
Rake::TestTask.new(:test) do |test| Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test' test.libs << 'test'
test.pattern = 'test/**/*_test.rb' test.pattern = 'test/**/*_test.rb'
test.verbose = true test.verbose = true
end end

View File

@ -1,15 +1,15 @@
# Generated by jeweler # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY # DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{hydra} s.name = %q{hydra}
s.version = "0.23.2" s.version = "0.23.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nick Gauthier"] s.authors = [%q{Nick Gauthier}]
s.date = %q{2010-11-03} s.date = %q{2011-08-23}
s.description = %q{Spread your tests over multiple machines to test your code faster.} s.description = %q{Spread your tests over multiple machines to test your code faster.}
s.email = %q{nick@smartlogicsolutions.com} s.email = %q{nick@smartlogicsolutions.com}
s.extra_rdoc_files = [ s.extra_rdoc_files = [
@ -19,7 +19,8 @@ Gem::Specification.new do |s|
] ]
s.files = [ s.files = [
".document", ".document",
".gitignore", "Gemfile",
"Gemfile.lock",
"LICENSE", "LICENSE",
"README.rdoc", "README.rdoc",
"Rakefile", "Rakefile",
@ -31,9 +32,13 @@ Gem::Specification.new do |s|
"hydra_gray.png", "hydra_gray.png",
"lib/hydra.rb", "lib/hydra.rb",
"lib/hydra/cucumber/formatter.rb", "lib/hydra/cucumber/formatter.rb",
"lib/hydra/cucumber/partial_html.rb",
"lib/hydra/hash.rb", "lib/hydra/hash.rb",
"lib/hydra/js/lint.js", "lib/hydra/js/lint.js",
"lib/hydra/listener/abstract.rb", "lib/hydra/listener/abstract.rb",
"lib/hydra/listener/cucumber.css",
"lib/hydra/listener/cucumber_html_report.rb",
"lib/hydra/listener/jquery-min.js",
"lib/hydra/listener/minimal_output.rb", "lib/hydra/listener/minimal_output.rb",
"lib/hydra/listener/notifier.rb", "lib/hydra/listener/notifier.rb",
"lib/hydra/listener/progress_bar.rb", "lib/hydra/listener/progress_bar.rb",
@ -46,6 +51,7 @@ Gem::Specification.new do |s|
"lib/hydra/messaging_io.rb", "lib/hydra/messaging_io.rb",
"lib/hydra/pipe.rb", "lib/hydra/pipe.rb",
"lib/hydra/runner.rb", "lib/hydra/runner.rb",
"lib/hydra/runner_listener/abstract.rb",
"lib/hydra/safe_fork.rb", "lib/hydra/safe_fork.rb",
"lib/hydra/spec/autorun_override.rb", "lib/hydra/spec/autorun_override.rb",
"lib/hydra/spec/hydra_formatter.rb", "lib/hydra/spec/hydra_formatter.rb",
@ -63,10 +69,15 @@ Gem::Specification.new do |s|
"test/fixtures/features/write_alternate_file.feature", "test/fixtures/features/write_alternate_file.feature",
"test/fixtures/features/write_file.feature", "test/fixtures/features/write_file.feature",
"test/fixtures/hello_world.rb", "test/fixtures/hello_world.rb",
"test/fixtures/hydra_worker_init.rb",
"test/fixtures/js_file.js", "test/fixtures/js_file.js",
"test/fixtures/json_data.json", "test/fixtures/json_data.json",
"test/fixtures/many_outputs_to_console.rb",
"test/fixtures/master_listeners.rb",
"test/fixtures/runner_listeners.rb",
"test/fixtures/slow.rb", "test/fixtures/slow.rb",
"test/fixtures/sync_test.rb", "test/fixtures/sync_test.rb",
"test/fixtures/task_test_config.yml",
"test/fixtures/write_file.rb", "test/fixtures/write_file.rb",
"test/fixtures/write_file_alternate_spec.rb", "test/fixtures/write_file_alternate_spec.rb",
"test/fixtures/write_file_spec.rb", "test/fixtures/write_file_spec.rb",
@ -77,53 +88,59 @@ Gem::Specification.new do |s|
"test/runner_test.rb", "test/runner_test.rb",
"test/ssh_test.rb", "test/ssh_test.rb",
"test/sync_test.rb", "test/sync_test.rb",
"test/task_test.rb",
"test/test_helper.rb", "test/test_helper.rb",
"test/worker_test.rb" "test/worker_test.rb"
] ]
s.homepage = %q{http://github.com/ngauthier/hydra} s.homepage = %q{http://github.com/ngauthier/hydra}
s.rdoc_options = ["--charset=UTF-8"] s.require_paths = [%q{lib}]
s.require_paths = ["lib"] s.rubygems_version = %q{1.8.6}
s.rubygems_version = %q{1.3.7}
s.summary = %q{Distributed testing toolkit} s.summary = %q{Distributed testing toolkit}
s.test_files = [
"test/pipe_test.rb",
"test/sync_test.rb",
"test/ssh_test.rb",
"test/fixtures/write_file_alternate_spec.rb",
"test/fixtures/sync_test.rb",
"test/fixtures/hello_world.rb",
"test/fixtures/features/step_definitions.rb",
"test/fixtures/assert_true.rb",
"test/fixtures/slow.rb",
"test/fixtures/write_file_spec.rb",
"test/fixtures/conflicting.rb",
"test/fixtures/write_file_with_pending_spec.rb",
"test/fixtures/write_file.rb",
"test/message_test.rb",
"test/test_helper.rb",
"test/master_test.rb",
"test/runner_test.rb",
"test/worker_test.rb"
]
if s.respond_to? :specification_version then if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3 s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<hydra>, [">= 0"])
s.add_development_dependency(%q<shoulda>, ["= 2.10.3"]) s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_development_dependency(%q<rspec>, ["= 2.0.0.beta.19"]) s.add_development_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_development_dependency(%q<therubyracer>, ["= 0.7.4"])
s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_development_dependency(%q<rspec>, ["= 2.6.4"])
s.add_development_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_development_dependency(%q<therubyracer>, ["= 0.7.4"])
s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
s.add_development_dependency(%q<rspec-core>, [">= 2.6.4"])
s.add_development_dependency(%q<cucumber>, ["= 0.9.2"]) s.add_development_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_development_dependency(%q<therubyracer>, ["= 0.7.4"]) s.add_development_dependency(%q<therubyracer>, ["= 0.7.4"])
else else
s.add_dependency(%q<hydra>, [">= 0"])
s.add_dependency(%q<shoulda>, ["= 2.10.3"]) s.add_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.19"]) s.add_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_dependency(%q<rspec>, ["= 2.6.4"])
s.add_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
s.add_dependency(%q<rspec-core>, [">= 2.6.4"])
s.add_dependency(%q<cucumber>, ["= 0.9.2"]) s.add_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_dependency(%q<therubyracer>, ["= 0.7.4"]) s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
end end
else else
s.add_dependency(%q<hydra>, [">= 0"])
s.add_dependency(%q<shoulda>, ["= 2.10.3"]) s.add_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.19"]) s.add_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_dependency(%q<rspec>, ["= 2.6.4"])
s.add_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
s.add_dependency(%q<rspec-core>, [">= 2.6.4"])
s.add_dependency(%q<cucumber>, ["= 0.9.2"]) s.add_dependency(%q<cucumber>, ["= 0.9.2"])
s.add_dependency(%q<therubyracer>, ["= 0.7.4"]) s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
end end

View File

@ -71,7 +71,7 @@ module Hydra #:nodoc:
@verbose = opts.fetch('verbose') { false } @verbose = opts.fetch('verbose') { false }
@autosort = opts.fetch('autosort') { true } @autosort = opts.fetch('autosort') { true }
@sync = opts.fetch('sync') { nil } @sync = opts.fetch('sync') { nil }
@environment = opts.fetch('environment') { 'test' } @environment = opts.fetch('environment') { 'test' } || 'test'
@options = opts.fetch('options') { '' } @options = opts.fetch('options') { '' }
if @autosort if @autosort
@ -174,15 +174,19 @@ module Hydra #:nodoc:
def boot_ssh_worker(worker) def boot_ssh_worker(worker)
sync = Sync.new(worker, @sync, @verbose) sync = Sync.new(worker, @sync, @verbose)
if sync.result == 0
runners = worker.fetch('runners') { raise "You must specify the number of runners" } runners = worker.fetch('runners') { raise "You must specify the number of runners" }
command = worker.fetch('command') { command = worker.fetch('command') {
"RAILS_ENV=#{@environment} ruby -e \"require 'rubygems'; require 'hydra'; Hydra::Worker.new(:io => Hydra::Stdio.new, :runners => #{runners}, :verbose => #{@verbose}, :runner_listeners => \'#{@string_runner_event_listeners}\', :runner_log_file => \'#{@runner_log_file}\' );\"" "RAILS_ENV=#{@environment} bundle exec ruby -e \"load 'config/application.rb'; require 'hydra'; Hydra::Worker.new(:io => Hydra::Stdio.new, :runners => #{runners}, :verbose => #{@verbose}, :runner_listeners => \'#{@string_runner_event_listeners}\', :runner_log_file => \'#{@runner_log_file}\', :options => {} );\""
} }
trace "Booting SSH worker" trace "Booting SSH worker"
trace command
ssh = Hydra::SSH.new("#{sync.ssh_opts} #{sync.connect}", sync.remote_dir, command) ssh = Hydra::SSH.new("#{sync.ssh_opts} #{sync.connect}", sync.remote_dir, command)
return { :io => ssh, :idle => false, :type => :ssh, :connect => sync.connect } return { :io => ssh, :idle => false, :type => :ssh, :connect => sync.connect }
else
false
end
end end
def shutdown_all_workers def shutdown_all_workers
@ -204,8 +208,9 @@ module Hydra #:nodoc:
trace "Listening to #{worker.inspect}" trace "Listening to #{worker.inspect}"
if worker.fetch('type') { 'local' }.to_s == 'ssh' if worker.fetch('type') { 'local' }.to_s == 'ssh'
worker = boot_ssh_worker(worker) worker = boot_ssh_worker(worker)
@workers << worker @workers << worker if worker
end end
if worker
while true while true
begin begin
message = worker[:io].gets message = worker[:io].gets
@ -222,6 +227,7 @@ module Hydra #:nodoc:
end end
end end
end end
end
@listeners.each{|l| l.join} @listeners.each{|l| l.join}
@event_listeners.each{|l| l.testing_end} @event_listeners.each{|l| l.testing_end}

View File

@ -7,7 +7,7 @@ module Hydra #:nodoc:
traceable('SYNC') traceable('SYNC')
self.class.traceable('SYNC MANY') self.class.traceable('SYNC MANY')
attr_reader :connect, :ssh_opts, :remote_dir attr_reader :connect, :ssh_opts, :remote_dir, :result
# Create a new Sync instance to rsync source from the local machine to a remote worker # Create a new Sync instance to rsync source from the local machine to a remote worker
# #
@ -47,6 +47,7 @@ module Hydra #:nodoc:
'rsync', 'rsync',
'-avz', '-avz',
'--delete', '--delete',
'--timeout=2',
exclude_opts, exclude_opts,
File.expand_path(@local_dir)+'/', File.expand_path(@local_dir)+'/',
"-e \"ssh #{@ssh_opts}\"", "-e \"ssh #{@ssh_opts}\"",
@ -54,6 +55,7 @@ module Hydra #:nodoc:
].join(" ") ].join(" ")
trace rsync_command trace rsync_command
trace `#{rsync_command}` trace `#{rsync_command}`
@result = $?.exitstatus
end end
def self.sync_many opts def self.sync_many opts

View File

@ -1,6 +1,6 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
require File.join(File.dirname(__FILE__), 'fixtures', 'runner_listeners') require 'fixtures/runner_listeners'
require File.join(File.dirname(__FILE__), 'fixtures', 'master_listeners') require 'fixtures/master_listeners'
class MasterTest < Test::Unit::TestCase class MasterTest < Test::Unit::TestCase
context "with a file to test and a destination to verify" do context "with a file to test and a destination to verify" do

View File

@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
class MessageTest < Test::Unit::TestCase class MessageTest < Test::Unit::TestCase
class MyMessage < Hydra::Message class MyMessage < Hydra::Message

View File

@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
class PipeTest < Test::Unit::TestCase class PipeTest < Test::Unit::TestCase
context "a pipe" do context "a pipe" do

View File

@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
require File.join(File.dirname(__FILE__), 'fixtures', 'runner_listeners') require 'fixtures/runner_listeners'
class RunnerTest < Test::Unit::TestCase class RunnerTest < Test::Unit::TestCase
context "with a file to test and a destination to verify" do context "with a file to test and a destination to verify" do

View File

@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
class SSHTest < Test::Unit::TestCase class SSHTest < Test::Unit::TestCase
should "be able to execute a command over ssh" do should "be able to execute a command over ssh" do

View File

@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
class SyncTest < Test::Unit::TestCase class SyncTest < Test::Unit::TestCase
context "with a file to test and a destination to verify" do context "with a file to test and a destination to verify" do
@ -37,6 +37,9 @@ class SyncTest < Test::Unit::TestCase
# ensure b is on remote # ensure b is on remote
assert File.exists?(File.join(remote, 'test_b.rb')), "B should be on remote" assert File.exists?(File.join(remote, 'test_b.rb')), "B should be on remote"
$stderr.puts local
$stderr.puts remote
Hydra::Sync.new( Hydra::Sync.new(
{ {
:type => :ssh, :type => :ssh,

View File

@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
require 'hydra/tasks' require 'hydra/tasks'
require 'rake' require 'rake'

View File

@ -1,7 +1,5 @@
require 'rubygems' require 'rubygems'
require 'test/unit' require 'test/unit'
gem 'shoulda', '2.10.3'
gem 'rspec', '2.0.0.beta.19'
require 'shoulda' require 'shoulda'
require 'tmpdir' require 'tmpdir'
require "stringio" require "stringio"

View File

@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper') require 'test_helper'
class WorkerTest < Test::Unit::TestCase class WorkerTest < Test::Unit::TestCase
context "with a file to test and a destination to verify" do context "with a file to test and a destination to verify" do