Skip to content
Browse files

Working on go builder, not ready yet.

  • Loading branch information...
1 parent e74890d commit 6d85541c216c5113a849c5459a905bc3b9e6ff4f @treeder treeder committed May 7, 2012
Showing with 50 additions and 1 deletion.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +15 −0 test/build_worker.rb
  4. +1 −1 test/helpers.rb
  5. +23 −0 test/test_builder.rb
  6. +7 −0 test/workers/hello.go
  7. +1 −0 test/workers/hello_go.worker
View
1 Gemfile
@@ -11,6 +11,7 @@ group :development do
end
group :test do
+ gem 'test-unit'
gem 'iron_worker_ng'
gem 'typhoeus'
gem 'pry'
View
2 Gemfile.lock
@@ -29,6 +29,7 @@ GEM
rest-client (1.6.7)
mime-types (>= 1.16)
slop (2.4.4)
+ test-unit (2.4.8)
typhoeus (0.3.3)
mime-types
zip (2.0.2)
@@ -44,5 +45,6 @@ DEPENDENCIES
json
pry
rake
+ test-unit
typhoeus
zip
View
15 test/build_worker.rb
@@ -0,0 +1,15 @@
+require 'iron_worker_ng'
+
+p params
+
+puts "ENV"
+p ENV
+
+puts "pwd: " + `pwd`
+puts `ls -al`
+
+@client = IronWorkerNG::Client.new(:token=>params['token'], :project_id=>params['project_id'])
+
+puts `go build hello.go`
+
+puts `ls -al`
View
2 test/helpers.rb
@@ -1,7 +1,7 @@
require 'test/unit'
require 'tempfile'
-require './lib/iron_worker_ng.rb'
+require_relative '../lib/iron_worker_ng.rb'
def code_bundle(*args,&block)
code = IronWorkerNG::Code::Ruby.new(*args)
View
23 test/test_builder.rb
@@ -0,0 +1,23 @@
+require_relative 'helpers'
+
+class BasicTest < IWNGTest
+ def test_build_worker
+ code = IronWorkerNG::Code::Ruby.new('build_worker.rb')
+ code.merge_gem 'iron_worker_ng'
+ code.merge_file 'workers/hello.go'
+ #code.merge_exec(File.dirname(__FILE__) + '/hello.rb')
+ client.codes_create(code)
+ task_id = client.tasks_create('BuildWorker', {:token=>client.api.token, :project_id=>client.api.project_id}).id
+
+ task = client.tasks_wait_for(task_id)
+ assert task
+ assert task.id == task_id
+ assert_equal "complete", task.status
+
+ log = client.tasks_log(task_id)
+ puts "LOG START"
+ puts log
+ puts "LOG END"
+ #assert_equal( "hello\n", log, "worker stdout is in log" )
+ end
+end
View
7 test/workers/hello.go
@@ -0,0 +1,7 @@
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello Gophers!")
+}
View
1 test/workers/hello_go.worker
@@ -0,0 +1 @@
+exec 'hello.go'

0 comments on commit 6d85541

Please sign in to comment.
Something went wrong with that request. Please try again.