Add test for custom per-role healthchecks

This adds the test for checking whether custom healthcheck options
in the role context are actually accepted into configuration.
This commit is contained in:
Farah Schüller
2023-11-20 16:15:44 +01:00
parent 635876bdb9
commit eb2a9b5f72

View File

@@ -46,6 +46,14 @@ class CommandsHealthcheckTest < ActiveSupport::TestCase
new_command.run.join(" ")
end
test "run with custom per-role healthcheck options" do
@config[:servers] = { "web" => { "hosts" => [ "1.1.1.1" ],
"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(" ")
end
test "status" do
assert_equal \
"docker container ls --all --filter name=^healthcheck-app-123$ --quiet | xargs docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}'",