From e5c5e892326a404216d07f203fb5f6dc8b6f770b Mon Sep 17 00:00:00 2001 From: Richard Taylor Date: Fri, 10 Mar 2023 15:55:04 +0000 Subject: [PATCH] Use custom web options for healthcheck If the web role has custom options, ensure these are used for the healthcheck. --- lib/mrsk/commands/healthcheck.rb | 1 + test/commands/healthcheck_test.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/mrsk/commands/healthcheck.rb b/lib/mrsk/commands/healthcheck.rb index 40ec2af7..722d2a05 100644 --- a/lib/mrsk/commands/healthcheck.rb +++ b/lib/mrsk/commands/healthcheck.rb @@ -11,6 +11,7 @@ class Mrsk::Commands::Healthcheck < Mrsk::Commands::Base "--label", "service=#{container_name}", *web.env_args, *config.volume_args, + *web.option_args, config.absolute_image, web.cmd end diff --git a/test/commands/healthcheck_test.rb b/test/commands/healthcheck_test.rb index 05fbc8c3..acf88fbd 100644 --- a/test/commands/healthcheck_test.rb +++ b/test/commands/healthcheck_test.rb @@ -30,6 +30,13 @@ class CommandsHealthcheckTest < ActiveSupport::TestCase new_command.run.join(" ") end + test "run with custom options" do + @config[:servers] = { "web" => { "hosts" => [ "1.1.1.1" ], "options" => { "mount" => "somewhere" } } } + assert_equal \ + "docker run --detach --name healthcheck-app-123 --publish 3999:3000 --label service=healthcheck-app --mount \"somewhere\" dhh/app:123", + new_command.run.join(" ") + end + test "curl" do assert_equal \ "curl --silent --output /dev/null --write-out '%{http_code}' --max-time 2 http://localhost:3999/up",