From 3f75c9fb76e87caaba49b048aadf2e5c8f8a212a Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 31 Aug 2011 14:40:58 -0400 Subject: [PATCH] even more test fixes, this almost works... --- lib/hydra/runner.rb | 1 + lib/hydra/ssh.rb | 6 ------ test/fixtures/write_file_alternate_spec.rb | 2 +- test/fixtures/write_file_spec.rb | 2 +- test/runner_test.rb | 2 +- test/ssh_test.rb | 5 +++-- test/worker_test.rb | 2 +- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/hydra/runner.rb b/lib/hydra/runner.rb index d3dc282..9a6ca56 100644 --- a/lib/hydra/runner.rb +++ b/lib/hydra/runner.rb @@ -40,6 +40,7 @@ module Hydra #:nodoc: for sign in [:SIGHUP, :INT] trap sign do stop + exit if @event_listeners.empty? end end @runner_began = true diff --git a/lib/hydra/ssh.rb b/lib/hydra/ssh.rb index 6c93574..ef6e740 100644 --- a/lib/hydra/ssh.rb +++ b/lib/hydra/ssh.rb @@ -28,11 +28,5 @@ module Hydra #:nodoc: def initialize(connection_options, directory, command) @writer, @reader, @error = popen3(%{ssh -tt #{connection_options} 'mkdir -p #{directory} && cd #{directory} && #{command}'}) end - - # Close the SSH connection - def close - @writer.write "exit\n" - super - end end end diff --git a/test/fixtures/write_file_alternate_spec.rb b/test/fixtures/write_file_alternate_spec.rb index e3ef5ac..7fe9408 100644 --- a/test/fixtures/write_file_alternate_spec.rb +++ b/test/fixtures/write_file_alternate_spec.rb @@ -1,6 +1,6 @@ require 'rspec' require 'hydra/tmpdir' -context "file writing" do +describe "file writing" do it "writes to a file" do File.open(File.join(Dir.consistent_tmpdir, 'alternate_hydra_test.txt'), 'a') do |f| f.write "HYDRA" diff --git a/test/fixtures/write_file_spec.rb b/test/fixtures/write_file_spec.rb index be2f4c8..189cb11 100644 --- a/test/fixtures/write_file_spec.rb +++ b/test/fixtures/write_file_spec.rb @@ -1,6 +1,6 @@ require 'rspec' require 'hydra/tmpdir' -context "file writing" do +describe "file writing" do it "writes to a file" do File.open(File.join(Dir.consistent_tmpdir, 'hydra_test.txt'), 'a') do |f| f.write "HYDRA" diff --git a/test/runner_test.rb b/test/runner_test.rb index 6301be2..be81f99 100644 --- a/test/runner_test.rb +++ b/test/runner_test.rb @@ -100,7 +100,7 @@ class RunnerTest < Test::Unit::TestCase should "be able to run a runner over ssh" do ssh = Hydra::SSH.new( - 'localhost', + 'localhost -o ControlMaster=no', File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')), %{ruby -rrubygems -e "require \\"bundler/setup\\"; require \\"hydra\\"; Hydra::Runner.new(:options => {}, :io => Hydra::Stdio.new, :verbose => true);"} ) diff --git a/test/ssh_test.rb b/test/ssh_test.rb index ca0f4bf..bba1a43 100644 --- a/test/ssh_test.rb +++ b/test/ssh_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class SSHTest < Test::Unit::TestCase should "be able to execute a command over ssh" do ssh = Hydra::SSH.new( - 'localhost', # connect to this machine + 'localhost -o ControlMaster=no', # connect to this machine File.expand_path(File.join(File.dirname(__FILE__))), # move to the test directory "ruby fixtures/hello_world.rb" ) @@ -14,7 +14,7 @@ class SSHTest < Test::Unit::TestCase should "be able to handle a large number of non-Hydra console output" do ssh = Hydra::SSH.new( - 'localhost', # connect to this machine + 'localhost -o ControlMaster=no', # connect to this machine File.expand_path(File.join(File.dirname(__FILE__))), # move to the test directory "ruby fixtures/many_outputs_to_console.rb" ) @@ -23,3 +23,4 @@ class SSHTest < Test::Unit::TestCase ssh.close end end + diff --git a/test/worker_test.rb b/test/worker_test.rb index 74102bb..5df5997 100644 --- a/test/worker_test.rb +++ b/test/worker_test.rb @@ -36,7 +36,7 @@ class WorkerTest < Test::Unit::TestCase module WorkerTestHelper def run_the_worker(pipe, num_runners) pipe.identify_as_child - Hydra::Worker.new({:io => pipe, :runners => num_runners}) + Hydra::Worker.new({:io => pipe, :runners => num_runners, :options => {}}) end def request_a_file_and_verify_completion(pipe, num_runners)