Files
kamal/test/configuration/ssh_test.rb
Donal McBreen 1163c3de07 Configurable log levels
Allow ssh log_level to be set - this will help to debug connection
issues.
2023-08-15 16:51:56 +01:00

37 lines
1.3 KiB
Ruby

require "test_helper"
class ConfigurationSshTest < ActiveSupport::TestCase
setup do
@deploy = {
service: "app", image: "dhh/app",
registry: { "username" => "dhh", "password" => "secret" },
env: { "REDIS_URL" => "redis://x/y" },
servers: [ "1.1.1.1", "1.1.1.2" ],
volumes: ["/local/path:/container/path"]
}
@config = Mrsk::Configuration.new(@deploy)
end
test "ssh options" do
assert_equal "root", @config.ssh.options[:user]
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "user" => "app" }) })
assert_equal "app", config.ssh.options[:user]
assert_equal 4, config.ssh.options[:logger].level
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "log_level" => "debug" }) })
assert_equal 0, config.ssh.options[:logger].level
end
test "ssh options with proxy host" do
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "proxy" => "1.2.3.4" }) })
assert_equal "root@1.2.3.4", config.ssh.options[:proxy].jump_proxies
end
test "ssh options with proxy host and user" do
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!(ssh: { "proxy" => "app@1.2.3.4" }) })
assert_equal "app@1.2.3.4", config.ssh.options[:proxy].jump_proxies
end
end