1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-19 14:57:04 +00:00

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.
This commit is contained in:
Alberto Bertogli
2018-03-25 13:33:16 +01:00
parent 4abffc9aaa
commit b0011f5a51
13 changed files with 449 additions and 5 deletions

View File

@@ -24,23 +24,21 @@ function init() {
trap "kill 0" EXIT
}
function generate_cert() {
go run ${UTILDIR}/generate_cert.go "$@"
}
function chasquid() {
if [ "${COVER_DIR}" != "" ]; then
chasquid_cover "$@"
return
fi
( cd ${TBASE}/../../; go build ${RACE} . )
# HOSTALIASES: so we "fake" hostnames.
# PATH: so chasquid can call test-mda without path issues.
# MDA_DIR: so our test-mda knows where to deliver emails.
HOSTALIASES=${TBASE}/hosts \
PATH=${UTILDIR}:${PATH} \
MDA_DIR=${TBASE}/.mail \
go run ${RACE} ${TBASE}/../../chasquid.go "$@"
${TBASE}/../../chasquid "$@"
}
function chasquid_cover() {
@@ -96,6 +94,18 @@ function chamuyero() {
${UTILDIR}/chamuyero "$@"
}
function generate_cert() {
go run ${UTILDIR}/generate_cert.go "$@"
}
function loadgen() {
go run ${UTILDIR}/loadgen.go "$@"
}
function conngen() {
go run ${UTILDIR}/conngen.go "$@"
}
function success() {
echo success
}
@@ -145,3 +155,11 @@ function skip_if_python_is_too_old() {
skip "python3 >= 3.5 not available"
fi
}
function chasquid_ram_peak() {
# Find the pid of the daemon, which we expect is running on the
# background somewhere within our current session.
SERVER_PID=`pgrep -s 0 -x chasquid`
echo $( cat /proc/$SERVER_PID/status | grep VmHWM | cut -d ':' -f 2- )
}