1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00
Files
go-chasquid-smtp/test/t-09-loop/run.sh
Alberto Bertogli 54cce0c2bf test: Reduce the loop detection threshold from 50 down to 5
The loop test can be quite slow, specially on computers without
cryptography-friendly instructions.

This patch introduces a new flag for testing, so that we can bring the
threshold down to 5. The test is just as useful but now runs in a few
seconds, as opposed to a few minutes.
2016-11-01 23:56:04 +00:00

45 lines
1000 B
Bash
Executable File

#!/bin/bash
set -e
. $(dirname ${0})/../util/lib.sh
init
rm -rf .data-A .data-B .mail
# Two servers:
# A - listens on :1025, hosts srv-A
# B - listens on :2015, hosts srv-B
#
# We cause the following loop:
# userA -> aliasB -> aliasA -> aliasB -> ...
CONFDIR=A generate_certs_for srv-A
CONFDIR=A add_user userA@srv-A userA
CONFDIR=B generate_certs_for srv-B
mkdir -p .logs-A .logs-B
chasquid -v=2 --logfile=.logs-A/chasquid.log --config_dir=A \
--testing__max_received_headers=5 \
--testing__outgoing_smtp_port=2025 &
chasquid -v=2 --logfile=.logs-B/chasquid.log --config_dir=B \
--testing__outgoing_smtp_port=1025 &
wait_until_ready 1025
wait_until_ready 2025
run_msmtp aliasB@srv-B < content
# Wait until one of them has noticed and stopped the loop.
while sleep 0.1; do
wget -q -O .data-A/vars http://localhost:1099/debug/vars
wget -q -O .data-B/vars http://localhost:2099/debug/vars
if grep -q '"chasquid/smtpIn/loopsDetected": 1,' .data-?/vars; then
break
fi
done
success