Avoid running tests while the services restart due to changes
This commit is contained in:
parent
c46edee8f9
commit
c6c6fb708c
|
@ -154,7 +154,7 @@ function private_config_path() {
|
||||||
# @return path to the folder where the config is duplicated
|
# @return path to the folder where the config is duplicated
|
||||||
function duplicate_config_for_container() {
|
function duplicate_config_for_container() {
|
||||||
output="$(private_config_path "$2")"
|
output="$(private_config_path "$2")"
|
||||||
rm -r "${output:?}/" # cleanup
|
rm -rf "${output:?}/" # cleanup
|
||||||
mkdir -p "$output"
|
mkdir -p "$output"
|
||||||
cp -r "$PWD/test/config/${1:?}/." "$output"
|
cp -r "$PWD/test/config/${1:?}/." "$output"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
@ -175,5 +175,14 @@ function wait_for_service() {
|
||||||
|
|
||||||
function count_processed_changes() {
|
function count_processed_changes() {
|
||||||
containerName=$1
|
containerName=$1
|
||||||
docker exec "$containerName" cat /var/log/supervisor/changedetector.log | grep "Change detected" -c
|
docker exec "$containerName" cat /var/log/supervisor/changedetector.log | grep "Change detected" -c \
|
||||||
|
|| [[ $? == 1 ]] # don't error when no matches were found
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function wait_for_changes_to_be_detected_in_container() {
|
||||||
|
containerName="$1"
|
||||||
|
timeout=${TEST_TIMEOUT_IN_SECONDS}
|
||||||
|
repeat_in_container_until_success_or_timeout "$timeout" "$containerName" \
|
||||||
|
bash -c 'source /usr/local/bin/helper_functions.sh; cmp --silent -- <(_monitored_files_checksums) "$CHKSUM_FILE" >/dev/null'
|
||||||
}
|
}
|
|
@ -30,12 +30,21 @@ setup_file() {
|
||||||
-e PERMIT_DOCKER=host \
|
-e PERMIT_DOCKER=host \
|
||||||
-e DMS_DEBUG=0 \
|
-e DMS_DEBUG=0 \
|
||||||
-h mail.my-domain.com -t ${NAME}
|
-h mail.my-domain.com -t ${NAME}
|
||||||
# generate account after run
|
|
||||||
|
wait_for_finished_setup_in_container mail
|
||||||
|
|
||||||
|
# generate accounts after container has been started
|
||||||
docker run --rm -e MAIL_USER=added@localhost.localdomain -e MAIL_PASS=mypassword -t ${NAME} /bin/sh -c 'echo "$MAIL_USER|$(doveadm pw -s SHA512-CRYPT -u $MAIL_USER -p $MAIL_PASS)"' >> "$private_config/postfix-accounts.cf"
|
docker run --rm -e MAIL_USER=added@localhost.localdomain -e MAIL_PASS=mypassword -t ${NAME} /bin/sh -c 'echo "$MAIL_USER|$(doveadm pw -s SHA512-CRYPT -u $MAIL_USER -p $MAIL_PASS)"' >> "$private_config/postfix-accounts.cf"
|
||||||
docker exec mail addmailuser pass@localhost.localdomain 'may be \a `p^a.*ssword'
|
docker exec mail addmailuser pass@localhost.localdomain 'may be \a `p^a.*ssword'
|
||||||
|
|
||||||
# setup sieve
|
# setup sieve
|
||||||
repeat_until_success_or_timeout 15 docker cp "$private_config/sieve/dovecot.sieve" mail:/var/mail/localhost.localdomain/user1/.dovecot.sieve
|
docker cp "$private_config/sieve/dovecot.sieve" mail:/var/mail/localhost.localdomain/user1/.dovecot.sieve
|
||||||
|
|
||||||
|
# this relies on the checksum file beeing updated after all changes have been applied
|
||||||
|
wait_for_changes_to_be_detected_in_container mail
|
||||||
|
|
||||||
wait_for_smtp_port_in_container mail
|
wait_for_smtp_port_in_container mail
|
||||||
|
|
||||||
# sending test mails
|
# sending test mails
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-spam.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-spam.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-virus.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-virus.txt"
|
||||||
|
|
Loading…
Reference in New Issue