Fix checksum race condition in check-for-changes.sh

If a change to one of the tracked files happened soon after (<1 second?)
a previously detected change, it could end up going undetected. In
particular, this could cause integration tests to fail (see next
commits).

Fixed by computing the new checksum file _before_ checking for changes.
This commit is contained in:
mwnx 2020-08-24 20:46:50 +02:00
parent f225e14a21
commit 2a70f33a4b
5 changed files with 39 additions and 32 deletions

View file

@ -118,7 +118,7 @@ function teardown_file() {
assert_output --partial "Cert found in /etc/letsencrypt/acme.json for *.example.com"
assert_output --partial "postfix: stopped"
assert_output --partial "postfix: started"
assert_output --partial "Update checksum"
assert_output --partial "Change detected"
run docker exec mail_lets_acme_json /bin/bash -c "cat /etc/letsencrypt/live/mail.my-domain.com/key.pem"
assert_output "$(cat "`pwd`/test/config/letsencrypt/changed/key.pem")"

View file

@ -20,7 +20,7 @@ function wait_for_service() {
function count_processed_changes() {
containerName=$1
docker exec $containerName cat /var/log/supervisor/changedetector.log | grep "Update checksum" | wc -l
docker exec $containerName cat /var/log/supervisor/changedetector.log | grep "Change detected" | wc -l
}
#