-
Notifications
You must be signed in to change notification settings - Fork 459
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
20 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ class CliAccessoryTest < CliTestCase | |
|
||
test "logs with follow" do | ||
SSHKit::Backend::Abstract.any_instance.stubs(:exec) | ||
.with("ssh -t [email protected] 'docker logs app-mysql --timestamps --tail 10 --follow 2>&1'") | ||
.with("ssh -t [email protected] -p 22 'docker logs app-mysql --timestamps --tail 10 --follow 2>&1'") | ||
|
||
assert_match "docker logs app-mysql --timestamps --tail 10 --follow 2>&1", run_command("logs", "mysql", "--follow") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,7 +172,7 @@ class CliAppTest < CliTestCase | |
|
||
test "exec interactive" do | ||
SSHKit::Backend::Abstract.any_instance.expects(:exec) | ||
.with("ssh -t [email protected] 'docker run -it --rm --env-file .kamal/env/roles/app-web.env dhh/app:latest ruby -v'") | ||
.with("ssh -t [email protected] -p 22 'docker run -it --rm --env-file .kamal/env/roles/app-web.env dhh/app:latest ruby -v'") | ||
run_command("exec", "-i", "ruby -v").tap do |output| | ||
assert_match "Get most recent version available as an image...", output | ||
assert_match "Launching interactive command with version latest via SSH from new container on 1.1.1.1...", output | ||
|
@@ -181,7 +181,7 @@ class CliAppTest < CliTestCase | |
|
||
test "exec interactive with reuse" do | ||
SSHKit::Backend::Abstract.any_instance.expects(:exec) | ||
.with("ssh -t [email protected] 'docker exec -it app-web-999 ruby -v'") | ||
.with("ssh -t [email protected] -p 22 'docker exec -it app-web-999 ruby -v'") | ||
run_command("exec", "-i", "--reuse", "ruby -v").tap do |output| | ||
assert_match "Get current version of running container...", output | ||
assert_match "Running docker ps --filter label=service=app --filter label=role=web --filter status=running --filter status=restarting --latest --format \"{{.Names}}\" | while read line; do echo ${line#app-web-}; done on 1.1.1.1", output | ||
|
@@ -210,7 +210,7 @@ class CliAppTest < CliTestCase | |
|
||
test "logs with follow" do | ||
SSHKit::Backend::Abstract.any_instance.stubs(:exec) | ||
.with("ssh -t [email protected] 'docker ps --quiet --filter label=service=app --filter label=role=web --filter status=running --filter status=restarting --latest | xargs docker logs --timestamps --tail 10 --follow 2>&1'") | ||
.with("ssh -t [email protected] -p 22 'docker ps --quiet --filter label=service=app --filter label=role=web --filter status=running --filter status=restarting --latest | xargs docker logs --timestamps --tail 10 --follow 2>&1'") | ||
|
||
assert_match "docker ps --quiet --filter label=service=app --filter label=role=web --filter status=running --filter status=restarting --latest | xargs docker logs --timestamps --tail 10 --follow 2>&1", run_command("logs", "--follow") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ class CliTraefikTest < CliTestCase | |
|
||
test "logs with follow" do | ||
SSHKit::Backend::Abstract.any_instance.stubs(:exec) | ||
.with("ssh -t [email protected] 'docker logs traefik --timestamps --tail 10 --follow 2>&1'") | ||
.with("ssh -t [email protected] -p 22 'docker logs traefik --timestamps --tail 10 --follow 2>&1'") | ||
|
||
assert_match "docker logs traefik --timestamps --tail 10 --follow", run_command("logs", "--follow") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,7 @@ class CommandsAccessoryTest < ActiveSupport::TestCase | |
|
||
test "follow logs" do | ||
assert_equal \ | ||
"ssh -t [email protected] 'docker logs app-mysql --timestamps --tail 10 --follow 2>&1'", | ||
"ssh -t [email protected] -p 22 'docker logs app-mysql --timestamps --tail 10 --follow 2>&1'", | ||
new_command(:mysql).follow_logs | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,32 +190,37 @@ class CommandsAppTest < ActiveSupport::TestCase | |
end | ||
|
||
test "run over ssh" do | ||
assert_equal "ssh -t [email protected] 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
assert_equal "ssh -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with custom user" do | ||
@config[:ssh] = { "user" => "app" } | ||
assert_equal "ssh -t [email protected] 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
assert_equal "ssh -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with custom port" do | ||
@config[:ssh] = { "port" => "2222" } | ||
assert_equal "ssh -t [email protected] -p 2222 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with proxy" do | ||
@config[:ssh] = { "proxy" => "2.2.2.2" } | ||
assert_equal "ssh -J [email protected] -t [email protected] 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
assert_equal "ssh -J [email protected] -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with proxy user" do | ||
@config[:ssh] = { "proxy" => "[email protected]" } | ||
assert_equal "ssh -J [email protected] -t [email protected] 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
assert_equal "ssh -J [email protected] -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with custom user with proxy" do | ||
@config[:ssh] = { "user" => "app", "proxy" => "2.2.2.2" } | ||
assert_equal "ssh -J [email protected] -t [email protected] 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
assert_equal "ssh -J [email protected] -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with proxy_command" do | ||
@config[:ssh] = { "proxy_command" => "ssh -W %h:%p user@proxy-server" } | ||
assert_equal "ssh -o ProxyCommand='ssh -W %h:%p user@proxy-server' -t [email protected] 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
assert_equal "ssh -o ProxyCommand='ssh -W %h:%p user@proxy-server' -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "current_running_container_id" do | ||
|
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 |
---|---|---|
|
@@ -167,13 +167,13 @@ class CommandsTraefikTest < ActiveSupport::TestCase | |
|
||
test "traefik follow logs" do | ||
assert_equal \ | ||
"ssh -t [email protected] 'docker logs traefik --timestamps --tail 10 --follow 2>&1'", | ||
"ssh -t [email protected] -p 22 'docker logs traefik --timestamps --tail 10 --follow 2>&1'", | ||
new_command.follow_logs(host: @config[:servers].first) | ||
end | ||
|
||
test "traefik follow logs with grep hello!" do | ||
assert_equal \ | ||
"ssh -t [email protected] 'docker logs traefik --timestamps --tail 10 --follow 2>&1 | grep \"hello!\"'", | ||
"ssh -t [email protected] -p 22 'docker logs traefik --timestamps --tail 10 --follow 2>&1 | grep \"hello!\"'", | ||
new_command.follow_logs(host: @config[:servers].first, grep: 'hello!') | ||
end | ||
|
||
|