From eb2a9b5f72303e888844529fcb86feba3b906c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Farah=20Sch=C3=BCller?= Date: Mon, 20 Nov 2023 16:15:44 +0100 Subject: [PATCH] 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. --- test/commands/healthcheck_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/commands/healthcheck_test.rb b/test/commands/healthcheck_test.rb index 66cdda6b..0148de52 100644 --- a/test/commands/healthcheck_test.rb +++ b/test/commands/healthcheck_test.rb @@ -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}}'",