Add basic container healthcheck (#2625)

This commit is contained in:
Casper 2022-06-07 11:54:58 +02:00 committed by GitHub
parent 62fdcb05f5
commit 72650d4dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -26,3 +26,7 @@ services:
stop_grace_period: 1m
cap_add:
- NET_ADMIN
healthcheck:
test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
timeout: 3s
retries: 0

View file

@ -37,6 +37,7 @@ setup_file() {
-e VIRUSMAILS_DELETE_DELAY=7 \
-h mail.my-domain.com \
--tty \
--health-cmd "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1" \
"${NAME}"
wait_for_finished_setup_in_container mail
@ -1206,6 +1207,16 @@ EOF
assert_failure
}
#
# healthcheck
#
@test "checking container healthcheck" {
run bash -c "docker inspect mail | jq -r '.[].State.Health.Status'"
assert_output "healthy"
assert_success
}
#
# supervisor
#