Retry healthcheck for up to 10 seconds (in case container wasnt ready)
This commit is contained in:
@@ -16,7 +16,7 @@ class Mrsk::Commands::Healthcheck < Mrsk::Commands::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def curl
|
def curl
|
||||||
[ :curl, "--silent", "--output", "/dev/null", "--write-out", "'%{http_code}'", health_url ]
|
[ :curl, "--silent", "--output", "/dev/null", "--write-out", "'%{http_code}'", "--retry-max-time", 10, "--retry", 5, health_url ]
|
||||||
end
|
end
|
||||||
|
|
||||||
def logs
|
def logs
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class CommandsHealthcheckTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test "curl" do
|
test "curl" do
|
||||||
assert_equal \
|
assert_equal \
|
||||||
"curl --silent --output /dev/null --write-out '%{http_code}' http://localhost:3999/up",
|
"curl --silent --output /dev/null --write-out '%{http_code}' --retry-max-time 10 --retry 5 http://localhost:3999/up",
|
||||||
new_command.curl.join(" ")
|
new_command.curl.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ class CommandsHealthcheckTest < ActiveSupport::TestCase
|
|||||||
@config[:healthcheck] = { "path" => "/healthz" }
|
@config[:healthcheck] = { "path" => "/healthz" }
|
||||||
|
|
||||||
assert_equal \
|
assert_equal \
|
||||||
"curl --silent --output /dev/null --write-out '%{http_code}' http://localhost:3999/healthz",
|
"curl --silent --output /dev/null --write-out '%{http_code}' --retry-max-time 10 --retry 5 http://localhost:3999/healthz",
|
||||||
new_command.curl.join(" ")
|
new_command.curl.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user