mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
tests: Wait at least 30 seconds before checking the health state of the container (#2777)
This commit is contained in:
parent
1f137f3eca
commit
b906d1ba6b
|
@ -4,6 +4,7 @@ export IMAGE_NAME
|
||||||
IMAGE_NAME="${NAME}"
|
IMAGE_NAME="${NAME}"
|
||||||
|
|
||||||
setup_file() {
|
setup_file() {
|
||||||
|
export START_TIME
|
||||||
local PRIVATE_CONFIG
|
local PRIVATE_CONFIG
|
||||||
PRIVATE_CONFIG=$(duplicate_config_for_container . mail)
|
PRIVATE_CONFIG=$(duplicate_config_for_container . mail)
|
||||||
mv "${PRIVATE_CONFIG}/user-patches/user-patches.sh" "${PRIVATE_CONFIG}/user-patches.sh"
|
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" \
|
--health-cmd "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1" \
|
||||||
"${NAME}"
|
"${NAME}"
|
||||||
|
|
||||||
|
START_TIME=$(date +%s)
|
||||||
wait_for_finished_setup_in_container mail
|
wait_for_finished_setup_in_container mail
|
||||||
|
|
||||||
# generate accounts after container has been started
|
# 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
|
# Be careful with re-locating this test if earlier tests could potentially fail it by
|
||||||
# triggering the `changedetector` service.
|
# triggering the `changedetector` service.
|
||||||
@test "checking container healthcheck" {
|
@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'"
|
run bash -c "docker inspect mail | jq -r '.[].State.Health.Status'"
|
||||||
assert_output "healthy"
|
assert_output "healthy"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
Loading…
Reference in a new issue