summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/test.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-06-23 15:49:03 -0700
committerelijah <elijah@riseup.net>2016-07-01 14:48:42 -0700
commitc77cace5225eb16d35865664754e88f4d67bba7f (patch)
tree2198b0e79cc7c397971e5466d07e7eb83ebfa68d /lib/leap_cli/commands/test.rb
parentcfb91a199c8c205b99c4424df77b0b6ed20e4288 (diff)
migrate commands to use new ssh system: node init, test, add-user
Diffstat (limited to 'lib/leap_cli/commands/test.rb')
-rw-r--r--lib/leap_cli/commands/test.rb41
1 files changed, 23 insertions, 18 deletions
diff --git a/lib/leap_cli/commands/test.rb b/lib/leap_cli/commands/test.rb
index f506d849..70eb00fd 100644
--- a/lib/leap_cli/commands/test.rb
+++ b/lib/leap_cli/commands/test.rb
@@ -7,24 +7,7 @@ module LeapCli; module Commands
test.command :run do |run|
run.switch 'continue', :desc => 'Continue over errors and failures (default is --no-continue).', :negatable => true
run.action do |global_options,options,args|
- test_order = File.join(Path.platform, 'tests/order.rb')
- if File.exist?(test_order)
- require test_order
- end
- manager.filter!(args).names_in_test_dependency_order.each do |node_name|
- node = manager.nodes[node_name]
- begin
- ssh_connect(node) do |ssh|
- ssh.run(test_cmd(options))
- end
- rescue Capistrano::CommandError
- if options[:continue]
- exit_status(1)
- else
- bail!
- end
- end
- end
+ do_test_run(global_options, options, args)
end
end
@@ -40,6 +23,28 @@ module LeapCli; module Commands
private
+ def do_test_run(global_options, options, args)
+ require 'leap_cli/ssh'
+ test_order = File.join(Path.platform, 'tests/order.rb')
+ if File.exist?(test_order)
+ require test_order
+ end
+ manager.filter!(args).names_in_test_dependency_order.each do |node_name|
+ node = manager.nodes[node_name]
+ begin
+ SSH::remote_command(node, options) do |ssh, host|
+ ssh.stream(test_cmd(options), :raise_error => true, :log_wrap => true)
+ end
+ rescue LeapCli::SSH::ExecuteError
+ if options[:continue]
+ exit_status(1)
+ else
+ bail!
+ end
+ end
+ end
+ end
+
def test_cmd(options)
if options[:continue]
"#{Leap::Platform.leap_dir}/bin/run_tests --continue"