even more test fixes, this almost works...
This commit is contained in:
parent
236de8be1a
commit
3f75c9fb76
@ -40,6 +40,7 @@ module Hydra #:nodoc:
|
|||||||
for sign in [:SIGHUP, :INT]
|
for sign in [:SIGHUP, :INT]
|
||||||
trap sign do
|
trap sign do
|
||||||
stop
|
stop
|
||||||
|
exit if @event_listeners.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@runner_began = true
|
@runner_began = true
|
||||||
|
@ -28,11 +28,5 @@ module Hydra #:nodoc:
|
|||||||
def initialize(connection_options, directory, command)
|
def initialize(connection_options, directory, command)
|
||||||
@writer, @reader, @error = popen3(%{ssh -tt #{connection_options} 'mkdir -p #{directory} && cd #{directory} && #{command}'})
|
@writer, @reader, @error = popen3(%{ssh -tt #{connection_options} 'mkdir -p #{directory} && cd #{directory} && #{command}'})
|
||||||
end
|
end
|
||||||
|
|
||||||
# Close the SSH connection
|
|
||||||
def close
|
|
||||||
@writer.write "exit\n"
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
2
test/fixtures/write_file_alternate_spec.rb
vendored
2
test/fixtures/write_file_alternate_spec.rb
vendored
@ -1,6 +1,6 @@
|
|||||||
require 'rspec'
|
require 'rspec'
|
||||||
require 'hydra/tmpdir'
|
require 'hydra/tmpdir'
|
||||||
context "file writing" do
|
describe "file writing" do
|
||||||
it "writes to a file" do
|
it "writes to a file" do
|
||||||
File.open(File.join(Dir.consistent_tmpdir, 'alternate_hydra_test.txt'), 'a') do |f|
|
File.open(File.join(Dir.consistent_tmpdir, 'alternate_hydra_test.txt'), 'a') do |f|
|
||||||
f.write "HYDRA"
|
f.write "HYDRA"
|
||||||
|
2
test/fixtures/write_file_spec.rb
vendored
2
test/fixtures/write_file_spec.rb
vendored
@ -1,6 +1,6 @@
|
|||||||
require 'rspec'
|
require 'rspec'
|
||||||
require 'hydra/tmpdir'
|
require 'hydra/tmpdir'
|
||||||
context "file writing" do
|
describe "file writing" do
|
||||||
it "writes to a file" do
|
it "writes to a file" do
|
||||||
File.open(File.join(Dir.consistent_tmpdir, 'hydra_test.txt'), 'a') do |f|
|
File.open(File.join(Dir.consistent_tmpdir, 'hydra_test.txt'), 'a') do |f|
|
||||||
f.write "HYDRA"
|
f.write "HYDRA"
|
||||||
|
@ -100,7 +100,7 @@ class RunnerTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
should "be able to run a runner over ssh" do
|
should "be able to run a runner over ssh" do
|
||||||
ssh = Hydra::SSH.new(
|
ssh = Hydra::SSH.new(
|
||||||
'localhost',
|
'localhost -o ControlMaster=no',
|
||||||
File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')),
|
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);"}
|
%{ruby -rrubygems -e "require \\"bundler/setup\\"; require \\"hydra\\"; Hydra::Runner.new(:options => {}, :io => Hydra::Stdio.new, :verbose => true);"}
|
||||||
)
|
)
|
||||||
|
@ -3,7 +3,7 @@ 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
|
||||||
ssh = Hydra::SSH.new(
|
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
|
File.expand_path(File.join(File.dirname(__FILE__))), # move to the test directory
|
||||||
"ruby fixtures/hello_world.rb"
|
"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
|
should "be able to handle a large number of non-Hydra console output" do
|
||||||
ssh = Hydra::SSH.new(
|
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
|
File.expand_path(File.join(File.dirname(__FILE__))), # move to the test directory
|
||||||
"ruby fixtures/many_outputs_to_console.rb"
|
"ruby fixtures/many_outputs_to_console.rb"
|
||||||
)
|
)
|
||||||
@ -23,3 +23,4 @@ class SSHTest < Test::Unit::TestCase
|
|||||||
ssh.close
|
ssh.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class WorkerTest < Test::Unit::TestCase
|
|||||||
module WorkerTestHelper
|
module WorkerTestHelper
|
||||||
def run_the_worker(pipe, num_runners)
|
def run_the_worker(pipe, num_runners)
|
||||||
pipe.identify_as_child
|
pipe.identify_as_child
|
||||||
Hydra::Worker.new({:io => pipe, :runners => num_runners})
|
Hydra::Worker.new({:io => pipe, :runners => num_runners, :options => {}})
|
||||||
end
|
end
|
||||||
|
|
||||||
def request_a_file_and_verify_completion(pipe, num_runners)
|
def request_a_file_and_verify_completion(pipe, num_runners)
|
||||||
|
Loading…
Reference in New Issue
Block a user