1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-22 15:27:02 +00:00
Files
go-chasquid-smtp/test/stress-02-connections/run.sh
Alberto Bertogli b0011f5a51 test: Add stress tests
This patch introduces stress tests, which put load on the daemon to help
sanity check its behaviour under stress.

They are separate from the existing integration tests, which focus on
correctness.

Two tests are included here: a load test, which sends emails repeatedly;
and a connection test which opens as many conections as possible.
2018-03-26 01:58:47 +01:00

36 lines
872 B
Bash
Executable File

#!/bin/bash
set -e
. $(dirname ${0})/../util/lib.sh
init
generate_certs_for testserver
add_user user@testserver secretpassword
# Note we run the server with minimal logging, to avoid generating very large
# log files, which are not very useful anyway.
mkdir -p .logs
chasquid -v=-1 --logfile=.logs/chasquid.log --config_dir=config &
wait_until_ready 1025
echo Peak RAM: `chasquid_ram_peak`
# Set connection count to (max open files) - (leeway).
# We set the leeway to account for file descriptors opened by the runtime and
# listeners; 20 should be enough for now.
# Cap it to 2000, as otherwise it can be problematic due to port availability.
COUNT=$(( `ulimit -n` - 20 ))
if [ $COUNT -gt 2000 ]; then
COUNT=2000
fi
if ! conngen -logtime -addr=localhost:1025 -count=$COUNT; then
tail -n 1 .logs/chasquid.log
fail
fi
echo Peak RAM: `chasquid_ram_peak`
success