diff --git a/test/fixtures/task_test_config.yml b/test/fixtures/task_test_config.yml new file mode 100644 index 0000000..40e4050 --- /dev/null +++ b/test/fixtures/task_test_config.yml @@ -0,0 +1,6 @@ +--- + workers: + - type: ssh + connect: localhost + directory: /tmp + runners: 1 \ No newline at end of file diff --git a/test/task_test.rb b/test/task_test.rb new file mode 100644 index 0000000..fc00be8 --- /dev/null +++ b/test/task_test.rb @@ -0,0 +1,21 @@ +require File.join(File.dirname(__FILE__), 'test_helper') +require 'hydra/tasks' +require 'rake' + +class TaskTest < Test::Unit::TestCase + context "a task" do + should "execute the command in a remote machine" do + + File.delete( "/tmp/new_file" ) if File.exists? "/tmp/new_file" + + Hydra::RemoteTask.new('cat:text_file', 'touch new_file') do |t| + t.config = "test/fixtures/task_test_config.yml" + end + + Rake.application['hydra:remote:cat:text_file'].invoke + + assert( File.exists? "/tmp/new_file" ) + + end + end +end