mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 10:05:00 +02:00
scripts: new log (#2493)
* added new `_log` function With `_log`, the `_notify` method wa rendered obsolete. `_notify` was not completely removed due to test failures in `check-for-changes.sh`. The new `_log` function properly uses log levels such as `trace`, `debug`, `info`, `warn` and `error`. It provides a cleaner solution and renders `DMS_DEBUG` obsolete too (as only `_notify` depends on it). * converted all helper script to new `_log` function * converted all startup stacks to new `log` function * `start-mailserver.sh` now uses new `_log` function * final test and misc small script adjustments * updated documentation
This commit is contained in:
parent
d8d4b6a189
commit
24031ae365
19 changed files with 367 additions and 221 deletions
|
@ -12,6 +12,7 @@ function setup_file() {
|
|||
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
|
||||
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=1 \
|
||||
-e LOG_LEVEL=trace \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
wait_for_finished_setup_in_container mail_changedetector_one
|
||||
|
||||
|
@ -19,6 +20,7 @@ function setup_file() {
|
|||
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
|
||||
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=1 \
|
||||
-e LOG_LEVEL=trace \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
wait_for_finished_setup_in_container mail_changedetector_two
|
||||
}
|
||||
|
@ -55,15 +57,15 @@ function teardown_file() {
|
|||
run docker exec mail_changedetector_two /bin/bash -c "supervisorctl start changedetector"
|
||||
sleep 15
|
||||
run docker exec mail_changedetector_one /bin/bash -c "supervisorctl tail changedetector"
|
||||
assert_output --partial "check-for-changes.sh.lock exists"
|
||||
assert_output --partial "another execution of 'check-for-changes.sh' is happening"
|
||||
run docker exec mail_changedetector_two /bin/bash -c "supervisorctl tail changedetector"
|
||||
assert_output --partial "check-for-changes.sh.lock exists"
|
||||
assert_output --partial "another execution of 'check-for-changes.sh' is happening"
|
||||
# Ensure starting a new check-for-changes.sh instance (restarting here) doesn't delete the lock
|
||||
docker exec mail_changedetector_two /bin/bash -c "rm -f /var/log/supervisor/changedetector.log"
|
||||
run docker exec mail_changedetector_two /bin/bash -c "supervisorctl restart changedetector"
|
||||
sleep 5
|
||||
run docker exec mail_changedetector_two /bin/bash -c "supervisorctl tail changedetector"
|
||||
refute_output --partial "check-for-changes.sh.lock exists"
|
||||
refute_output --partial "another execution of 'check-for-changes.sh' is happening"
|
||||
refute_output --partial "Removed lock"
|
||||
}
|
||||
|
||||
|
@ -73,8 +75,8 @@ function teardown_file() {
|
|||
echo "" >> "$(private_config_path mail_changedetector_one)/postfix-accounts.cf"
|
||||
sleep 15
|
||||
run docker exec mail_changedetector_one /bin/bash -c "supervisorctl tail changedetector"
|
||||
assert_output --partial "check-for-changes.sh.lock exists"
|
||||
assert_output --partial "another execution of 'check-for-changes.sh' is happening"
|
||||
sleep 65
|
||||
run docker exec mail_changedetector_one /bin/bash -c "supervisorctl tail -3000 changedetector"
|
||||
assert_output --partial "Removed stale lock"
|
||||
assert_output --partial "removing stale lock file"
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ function teardown() {
|
|||
local TEST_DOCKER_ARGS=(
|
||||
--volume "${TEST_TMP_CONFIG}/letsencrypt/acme.json:/etc/letsencrypt/acme.json:ro"
|
||||
--env DMS_DEBUG=1
|
||||
--env LOG_LEVEL=trace
|
||||
--env PERMIT_DOCKER='container'
|
||||
--env SSL_DOMAIN='*.example.test'
|
||||
--env SSL_TYPE='letsencrypt'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue