1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-08 17:51:57 +00:00

test: Integration test for reload

This patch implements an integration test for reloading; in particular
it exercises reloading aliases and user databases.
This commit is contained in:
Alberto Bertogli
2018-03-02 16:15:15 +00:00
parent 0611b7a7fc
commit 751fbd4b55
7 changed files with 72 additions and 1 deletions

1
test/t-13-reload/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config/domains/testserver/aliases

View File

@@ -0,0 +1,9 @@
smtp_address: ":1025"
submission_address: ":1587"
monitoring_address: ":1099"
mail_delivery_agent_bin: "test-mda"
mail_delivery_agent_args: "%to%"
data_dir: "../.data"
mail_log_path: "../.logs/mail_log"

4
test/t-13-reload/content Normal file
View File

@@ -0,0 +1,4 @@
Subject: Prueba desde el test
Crece desde el test el futuro
Crece desde el test

1
test/t-13-reload/hosts Normal file
View File

@@ -0,0 +1 @@
testserver localhost

14
test/t-13-reload/msmtprc Normal file
View File

@@ -0,0 +1,14 @@
account default
host testserver
port 1587
tls on
tls_trust_file config/certs/testserver/fullchain.pem
from someone@testserver
auth on
user someone@testserver
password password222

33
test/t-13-reload/run.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
set -e
. $(dirname ${0})/../util/lib.sh
init
generate_certs_for testserver
# Start with the user with the wrong password, and no aliases.
add_user someone@testserver password111
rm -f config/domains/testserver/aliases
mkdir -p .logs
chasquid -v=2 --logfile=.logs/chasquid.log --config_dir=config \
--testing__reload_every=50ms &
wait_until_ready 1025
# First, check that delivery fails with the "wrong" password.
if run_msmtp someone@testserver < content 2>/dev/null; then
fail "success using the wrong password"
fi
# Change password, add an alias; then wait a bit more than the reload period
# and try again.
add_user someone@testserver password222
echo "analias: someone" > config/domains/testserver/aliases
sleep 0.2
run_msmtp analias@testserver < content
wait_for_file .mail/someone@testserver
success