diff --git a/lib/kamal/commands/healthcheck.rb b/lib/kamal/commands/healthcheck.rb index b61ad3df..9d785326 100644 --- a/lib/kamal/commands/healthcheck.rb +++ b/lib/kamal/commands/healthcheck.rb @@ -26,7 +26,7 @@ class Kamal::Commands::Healthcheck < Kamal::Commands::Base end def logs - pipe container_id, xargs(docker(:logs, "--tail", lines, "2>&1")) + pipe container_id, xargs(docker(:logs, "--tail", log_lines, "2>&1")) end def stop @@ -58,7 +58,7 @@ class Kamal::Commands::Healthcheck < Kamal::Commands::Base config.healthcheck["exposed_port"] end - def lines - config.healthcheck["lines"] + def log_lines + config.healthcheck["log_lines"] end end diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index a076e991..4809ec8e 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -149,7 +149,7 @@ class Kamal::Configuration def healthcheck - { "path" => "/up", "port" => 3000, "max_attempts" => 7, "exposed_port" => 3999, "cord" => "/tmp/kamal-cord", "lines" => 50 }.merge(raw_config.healthcheck || {}) + { "path" => "/up", "port" => 3000, "max_attempts" => 7, "exposed_port" => 3999, "cord" => "/tmp/kamal-cord", "log_lines" => 50 }.merge(raw_config.healthcheck || {}) end def readiness_delay diff --git a/test/commands/healthcheck_test.rb b/test/commands/healthcheck_test.rb index 21a8876d..66cdda6b 100644 --- a/test/commands/healthcheck_test.rb +++ b/test/commands/healthcheck_test.rb @@ -93,7 +93,7 @@ class CommandsHealthcheckTest < ActiveSupport::TestCase end test "logs with custom lines number" do - @config[:healthcheck] = { "lines" => 150 } + @config[:healthcheck] = { "log_lines" => 150 } assert_equal \ "docker container ls --all --filter name=^healthcheck-app-123$ --quiet | xargs docker logs --tail 150 2>&1", new_command.logs.join(" ") diff --git a/test/configuration_test.rb b/test/configuration_test.rb index be448fcf..a1e89276 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -224,7 +224,7 @@ class ConfigurationTest < ActiveSupport::TestCase :volume_args=>["--volume", "/local/path:/container/path"], :builder=>{}, :logging=>["--log-opt", "max-size=\"10m\""], - :healthcheck=>{ "path"=>"/up", "port"=>3000, "max_attempts" => 7, "exposed_port" => 3999, "cord" => "/tmp/kamal-cord", "lines" => 50 }} + :healthcheck=>{ "path"=>"/up", "port"=>3000, "max_attempts" => 7, "exposed_port" => 3999, "cord" => "/tmp/kamal-cord", "log_lines" => 50 }} assert_equal expected_config, @config.to_h end diff --git a/test/integration/main_test.rb b/test/integration/main_test.rb index bd9c1065..50bc7560 100644 --- a/test/integration/main_test.rb +++ b/test/integration/main_test.rb @@ -54,7 +54,7 @@ class MainTest < IntegrationTest assert_equal({ user: "root", auth_methods: [ "publickey" ], keepalive: true, keepalive_interval: 30, log_level: :fatal }, config[:ssh_options]) assert_equal({ "multiarch" => false, "args" => { "COMMIT_SHA" => version } }, config[:builder]) assert_equal [ "--log-opt", "max-size=\"10m\"" ], config[:logging] - assert_equal({ "path" => "/up", "port" => 3000, "max_attempts" => 7, "exposed_port" => 3999, "cord"=>"/tmp/kamal-cord", "lines" => 50, "cmd"=>"wget -qO- http://localhost > /dev/null || exit 1" }, config[:healthcheck]) + assert_equal({ "path" => "/up", "port" => 3000, "max_attempts" => 7, "exposed_port" => 3999, "cord"=>"/tmp/kamal-cord", "log_lines" => 50, "cmd"=>"wget -qO- http://localhost > /dev/null || exit 1" }, config[:healthcheck]) end private