mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Extract container mail_smtponly_without_config into test
This commit is contained in:
parent
ad0be553d8
commit
06b137e5a8
7
Makefile
7
Makefile
|
@ -54,13 +54,6 @@ run:
|
||||||
-e DMS_DEBUG=0 \
|
-e DMS_DEBUG=0 \
|
||||||
-h mail.my-domain.com -t $(NAME)
|
-h mail.my-domain.com -t $(NAME)
|
||||||
-@ sleep $(SLEEP)
|
-@ sleep $(SLEEP)
|
||||||
docker run --rm -d --name mail_smtponly_without_config \
|
|
||||||
-e SMTP_ONLY=1 \
|
|
||||||
-e ENABLE_LDAP=1 \
|
|
||||||
-e PERMIT_DOCKER=network \
|
|
||||||
-e OVERRIDE_HOSTNAME=mail.mydomain.com \
|
|
||||||
-t $(NAME)
|
|
||||||
-@ sleep $(SLEEP)
|
|
||||||
docker run --rm -d --name mail_override_hostname \
|
docker run --rm -d --name mail_override_hostname \
|
||||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||||
|
|
|
@ -37,6 +37,16 @@ function repeat_until_success_or_timeout {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @param $1 timeout
|
||||||
|
# @param $2 container name
|
||||||
|
# @param ... test command for container
|
||||||
|
function repeat_in_container_until_success_or_timeout() {
|
||||||
|
timeout="$1"
|
||||||
|
container_name="$2"
|
||||||
|
shift 2
|
||||||
|
repeat_until_success_or_timeout "$timeout" --fatal-test "container_is_running $container_name" docker exec "$container_name" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
function container_is_running() {
|
function container_is_running() {
|
||||||
[[ "$(docker inspect -f '{{.State.Running}}' "$1")" == "true" ]]
|
[[ "$(docker inspect -f '{{.State.Running}}' "$1")" == "true" ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,7 +407,16 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking opendkim: /etc/opendkim/KeyTable dummy file generated without keys provided" {
|
@test "checking opendkim: /etc/opendkim/KeyTable dummy file generated without keys provided" {
|
||||||
run docker exec mail_smtponly_without_config /bin/bash -c "cat /etc/opendkim/KeyTable"
|
docker run --rm -d --name mail_smtponly_without_config \
|
||||||
|
-e SMTP_ONLY=1 \
|
||||||
|
-e ENABLE_LDAP=1 \
|
||||||
|
-e PERMIT_DOCKER=network \
|
||||||
|
-e OVERRIDE_HOSTNAME=mail.mydomain.com \
|
||||||
|
-t ${NAME}
|
||||||
|
|
||||||
|
teardown() { docker rm -f mail_smtponly_without_config; }
|
||||||
|
|
||||||
|
run repeat_in_container_until_success_or_timeout 15 mail_smtponly_without_config /bin/bash -c "cat /etc/opendkim/KeyTable"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue