tests: Wait at least 30 seconds before checking the health state of the container (#2777)

This commit is contained in:
Casper 2022-09-19 12:54:33 +02:00 committed by GitHub
parent 1f137f3eca
commit b906d1ba6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@ export IMAGE_NAME
IMAGE_NAME="${NAME}"
setup_file() {
export START_TIME
local PRIVATE_CONFIG
PRIVATE_CONFIG=$(duplicate_config_for_container . mail)
mv "${PRIVATE_CONFIG}/user-patches/user-patches.sh" "${PRIVATE_CONFIG}/user-patches.sh"
@ -41,6 +42,7 @@ setup_file() {
--health-cmd "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1" \
"${NAME}"
START_TIME=$(date +%s)
wait_for_finished_setup_in_container mail
# generate accounts after container has been started
@ -110,6 +112,13 @@ teardown_file() {
# Be careful with re-locating this test if earlier tests could potentially fail it by
# triggering the `changedetector` service.
@test "checking container healthcheck" {
local NOW
NOW=$(date +%s)
# ensure, that at least 30 seconds have passed since container start
while (( NOW - START_TIME < 31 )); do
sleep 1
NOW=$(date +%s)
done
run bash -c "docker inspect mail | jq -r '.[].State.Health.Status'"
assert_output "healthy"
assert_success