Use custom web options for healthcheck

If the web role has custom options, ensure these are used for the
healthcheck.
This commit is contained in:
Richard Taylor
2023-03-10 15:55:04 +00:00
parent 3026a92c98
commit e5c5e89232
2 changed files with 8 additions and 0 deletions

View File

@@ -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

View File

@@ -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",