Merge pull request #102 from moomerman/cmd-options-for-healthcheck

Use custom web options for healthcheck
This commit is contained in:
David Heinemeier Hansson
2023-03-13 15:12:25 +01:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ class Mrsk::Commands::Healthcheck < Mrsk::Commands::Base
"-e", "MRSK_CONTAINER_NAME=\"#{container_name}\"", "-e", "MRSK_CONTAINER_NAME=\"#{container_name}\"",
*web.env_args, *web.env_args,
*config.volume_args, *config.volume_args,
*web.option_args,
config.absolute_image, config.absolute_image,
web.cmd web.cmd
end end

View File

@@ -30,6 +30,13 @@ class CommandsHealthcheckTest < ActiveSupport::TestCase
new_command.run.join(" ") new_command.run.join(" ")
end 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 test "curl" do
assert_equal \ assert_equal \
"curl --silent --output /dev/null --write-out '%{http_code}' --max-time 2 http://localhost:3999/up", "curl --silent --output /dev/null --write-out '%{http_code}' --max-time 2 http://localhost:3999/up",