mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Merge pull request #1323 from ap-wtioit/master-remove_tty_necessity
fix: dont use TTY in docker if not present, rem TTY necessity in tests
This commit is contained in:
commit
2ad667209c
12
setup.sh
12
setup.sh
|
@ -98,10 +98,14 @@ _docker_image_exists() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -t 1 ] ; then
|
||||||
|
USE_TTY="-ti"
|
||||||
|
fi
|
||||||
|
|
||||||
_docker_image() {
|
_docker_image() {
|
||||||
if [ "$USE_CONTAINER" = true ]; then
|
if [ "$USE_CONTAINER" = true ]; then
|
||||||
# Reuse existing container specified on command line
|
# Reuse existing container specified on command line
|
||||||
docker exec -ti "$CONTAINER_NAME" "$@"
|
docker exec ${USE_TTY} "$CONTAINER_NAME" "$@"
|
||||||
else
|
else
|
||||||
# Start temporary container with specified image
|
# Start temporary container with specified image
|
||||||
if ! _docker_image_exists "$IMAGE_NAME"; then
|
if ! _docker_image_exists "$IMAGE_NAME"; then
|
||||||
|
@ -112,13 +116,13 @@ _docker_image() {
|
||||||
docker run \
|
docker run \
|
||||||
--rm \
|
--rm \
|
||||||
-v "$CONFIG_PATH":/tmp/docker-mailserver \
|
-v "$CONFIG_PATH":/tmp/docker-mailserver \
|
||||||
-ti "$IMAGE_NAME" $@
|
${USE_TTY} "$IMAGE_NAME" $@
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_docker_container() {
|
_docker_container() {
|
||||||
if [ -n "$CONTAINER_NAME" ]; then
|
if [ -n "$CONTAINER_NAME" ]; then
|
||||||
docker exec -ti "$CONTAINER_NAME" "$@"
|
docker exec ${USE_TTY} "$CONTAINER_NAME" "$@"
|
||||||
else
|
else
|
||||||
echo "The docker-mailserver is not running!"
|
echo "The docker-mailserver is not running!"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -273,7 +277,7 @@ case $1 in
|
||||||
;;
|
;;
|
||||||
login)
|
login)
|
||||||
shift
|
shift
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
_docker_container /bin/bash
|
_docker_container /bin/bash
|
||||||
else
|
else
|
||||||
_docker_container /bin/bash -c "$@"
|
_docker_container /bin/bash -c "$@"
|
||||||
|
|
|
@ -701,13 +701,13 @@ function count_processed_changes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking amavis: VIRUSMAILS_DELETE_DELAY override works as expected" {
|
@test "checking amavis: VIRUSMAILS_DELETE_DELAY override works as expected" {
|
||||||
run docker run -ti --rm -e VIRUSMAILS_DELETE_DELAY=2 `docker inspect --format '{{ .Config.Image }}' mail` /bin/bash -c 'echo $VIRUSMAILS_DELETE_DELAY | grep 2'
|
run docker run --rm -e VIRUSMAILS_DELETE_DELAY=2 `docker inspect --format '{{ .Config.Image }}' mail` /bin/bash -c 'echo $VIRUSMAILS_DELETE_DELAY | grep 2'
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking amavis: old virusmail is wipped by cron" {
|
@test "checking amavis: old virusmail is wipped by cron" {
|
||||||
docker exec mail bash -c 'touch -d "`date --date=2000-01-01`" /var/lib/amavis/virusmails/should-be-deleted'
|
docker exec mail bash -c 'touch -d "`date --date=2000-01-01`" /var/lib/amavis/virusmails/should-be-deleted'
|
||||||
run docker exec -ti mail bash -c '/usr/local/bin/virus-wiper'
|
run docker exec mail bash -c '/usr/local/bin/virus-wiper'
|
||||||
assert_success
|
assert_success
|
||||||
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-be-deleted'
|
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-be-deleted'
|
||||||
assert_failure
|
assert_failure
|
||||||
|
@ -715,7 +715,7 @@ function count_processed_changes() {
|
||||||
|
|
||||||
@test "checking amavis: recent virusmail is not wipped by cron" {
|
@test "checking amavis: recent virusmail is not wipped by cron" {
|
||||||
docker exec mail bash -c 'touch -d "`date`" /var/lib/amavis/virusmails/should-not-be-deleted'
|
docker exec mail bash -c 'touch -d "`date`" /var/lib/amavis/virusmails/should-not-be-deleted'
|
||||||
run docker exec -ti mail bash -c '/usr/local/bin/virus-wiper'
|
run docker exec mail bash -c '/usr/local/bin/virus-wiper'
|
||||||
assert_success
|
assert_success
|
||||||
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-not-be-deleted'
|
run docker exec mail bash -c 'ls -la /var/lib/amavis/virusmails/ | grep should-not-be-deleted'
|
||||||
assert_success
|
assert_success
|
||||||
|
|
Loading…
Reference in a new issue