Added test for RemoteTasks that run arbitrary commands

This commit is contained in:
Arturo 2011-04-26 15:33:14 -04:00
parent beae81621d
commit 3ca3f1cd24
2 changed files with 27 additions and 0 deletions

6
test/fixtures/task_test_config.yml vendored Normal file
View File

@ -0,0 +1,6 @@
---
workers:
- type: ssh
connect: localhost
directory: /tmp
runners: 1

21
test/task_test.rb Normal file
View File

@ -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