Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$:.unshift('lib') | ||
load 'bin/iron_worker' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'helpers' | ||
|
||
class CLITest < IWNGTest | ||
|
||
def cli(*args) | ||
if args.last.is_a? Hash | ||
args.pop.each do |k,v| | ||
args << "--" + k.to_s.gsub(/_/,'-') + " " + v.to_s | ||
end | ||
end | ||
|
||
out = Tempfile.new('cli_output').path | ||
args << "2>&1 >#{out}" | ||
|
||
cmd = 'ruby test/cli_runner.rb ' + args.join(' ') | ||
puts cmd | ||
|
||
puts "----------------------------------------------------------" | ||
|
||
ENV['LOG_LEVEL'] = 'DEBUG' | ||
exec(cmd) if fork.nil? | ||
Process.wait | ||
|
||
puts File.read(out) | ||
|
||
puts "----------------------------------------------------------" | ||
|
||
assert $?.success? | ||
|
||
File.read(out) | ||
end | ||
|
||
def test_basic | ||
assert cli('codes.create', ruby_merge_exec: 'test/hello.rb') =~ | ||
/Upload successful/ | ||
|
||
assert cli('tasks.create', name: 'Hello') =~ | ||
/Queued up.*"id":"(.{24})"/ | ||
|
||
assert cli('tasks.log', '--live', task_id: $1) =~ | ||
/\nhello\n/ | ||
|
||
assert cli('schedules.create', name: 'Hello') =~ | ||
/Scheduled/ | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters