/
test_change_runtime.rb
48 lines (37 loc) · 1.07 KB
/
test_change_runtime.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'helpers'
class ChangeRuntimeTest < IWNGTest
# Alexander S.
# btw looks like its a bug:
# 1) upload worker with any name
# 2) upload worker with same name and different runtime
# 3) launch it and gaze on error
def ruby_worker(code_name)
client.codes_create( code_bundle do
name code_name
worker_code 'puts "hello"'
end )
task = client.tasks.create(code_name)
client.tasks.wait_for task.id
assert_equal "hello\n", client.tasks.log(task.id)
end
def sh_worker(code_name)
code = IronWorkerNG::Code::Base.new do
runtime 'binary'
name code_name
exec(Tempfile.open('sh') do |f|
f << 'echo "hello"'
end.path)
end
task = client.tasks.create(code_name)
client.tasks.wait_for task.id
assert_equal "hello\n", client.tasks.log(task.id)
end
def test_sh_to_ruby
sh_worker 'sh_to_ruby'
ruby_worker 'sh_to_ruby'
end
def test_ruby_to_sh
ruby_worker 'ruby_to_sh'
sh_worker 'ruby_to_sh'
end
end