Skip to content

Commit

Permalink
test for parallel SSHKit.run execution with :parallel option
Browse files Browse the repository at this point in the history
  • Loading branch information
seungjin committed Sep 3, 2018
1 parent 95ed0f7 commit 0d239f6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/sshkit_functional_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ defmodule SSHKitFunctionalTest do
assert name == host.options[:user]
end

@tag boot: [@bootconf]
test "connects as the login user and runs commands in parallel", %{hosts: [host]} do
begin_time = Time.utc_now()
[{:ok, output1, 0},{:ok, output2, 0},{:ok, output3, 0}] =
[host, host, host]
|> SSHKit.context()
|> SSHKit.run("sleep 2; id -un", :parallel)
end_time = Time.utc_now()
run_time = Time.diff(end_time, begin_time, :second)

assert run_time < 3
assert String.trim(stdout(output1)) == host.options[:user]
assert String.trim(stdout(output2)) == host.options[:user]
assert String.trim(stdout(output3)) == host.options[:user]

end

@tag boot: [@bootconf]
test "runs commands and returns their output and exit status", %{hosts: [host]} do
context = SSHKit.context(host)
Expand Down

0 comments on commit 0d239f6

Please sign in to comment.