rsyslog/tests/execonlywhenprevsuspended_multiwrkr.sh
Rainer Gerhards 85b0f11981 testbench fix: execonlywhenprevsuspended_multiwrkr.sh occasionally failed
The root cause of the problem was a race condition. Test instrumentation
sets failure state after 2 messages. It expected that these messages were
actually the first ones injected. Especially on slower systems, a second
worker may begin processing before the first one, in which case the first
two messages have different numbers. We have changed this to ensure that
first two are always those that we expect.

Note that this does not compromise the test: all worked well, it was just
a race in regard to the test predicate we check. So actually the test
setup was wrong, not the test method as such or the to-be-tested code.

closes https://github.com/rsyslog/rsyslog/issues/842
2016-04-22 11:57:39 +02:00

18 lines
785 B
Bash
Executable File

#!/bin/bash
# rgerhards, 2013-12-05
echo =====================================================================================
echo \[execonlywhenprevsuspended_multiwrkr.sh\]: test execonly...suspended functionality multiworker case
. $srcdir/diag.sh init
. $srcdir/diag.sh startup execonlywhenprevsuspended_multiwrkr.conf
# we initially send only 10 messages. It has shown that if we send more,
# we cannot really control which are the first two messages imdiag sees,
# and so we do not know for sure which numbers are skipped. So we inject
# those 10 to get past that point.
. $srcdir/diag.sh injectmsg 0 10
./msleep 500
. $srcdir/diag.sh injectmsg 10 990
. $srcdir/diag.sh shutdown-when-empty
. $srcdir/diag.sh wait-shutdown
. $srcdir/diag.sh seq-check 1 999
. $srcdir/diag.sh exit