Browse files

adding test for workerfile

  • Loading branch information...
1 parent 5eb2ab7 commit 3ea3d696d51c688600953b80f4c188f273ba4533 @romand romand committed May 11, 2012
Showing with 29 additions and 0 deletions.
  1. +1 −0 test/hello.sh
  2. +28 −0 test/test_workerfile.rb
View
1 test/hello.sh
@@ -0,0 +1 @@
+echo "hello"
View
28 test/test_workerfile.rb
@@ -0,0 +1,28 @@
+require 'helpers'
+
+class WorkerfileTest < IWNGTest
+
+ def workerfile(str)
+ dir = Dir.mktmpdir('workerfile_test')
+ File.open(dir + '/Workerfile', 'w'){ |f| f << str }.path
+ end
+
+ def test_basic
+ wf = workerfile <<EOF
+runtime 'binary'
+name 'ShHello'
+exec 'test/hello.sh'
+EOF
+
+ code = IronWorkerNG::Code.create(:workerfile => wf)
+
+ client.codes.create(code)
+
+ id = client.tasks.create('ShHello').id
+
+ client.tasks.wait_for(id)
+
+ assert_equal "hello\n", client.tasks.log(id)
+ end
+
+end

0 comments on commit 3ea3d69

Please sign in to comment.