From 3ca3f1cd241c3632c0c8712c2036c78a040f5a25 Mon Sep 17 00:00:00 2001 From: Arturo Date: Tue, 26 Apr 2011 15:33:14 -0400 Subject: [PATCH] Added test for RemoteTasks that run arbitrary commands --- test/fixtures/task_test_config.yml | 6 ++++++ test/task_test.rb | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/fixtures/task_test_config.yml create mode 100644 test/task_test.rb 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