adjust test timing for slow boxes (#1681)

This commit is contained in:
mmetc 2022-07-26 09:47:56 +02:00 committed by GitHub
parent e13867f7c9
commit 804b6f4c5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View file

@ -31,12 +31,14 @@ declare stderr
}
@test "crowdsec should not run without LAPI (-no-api flag)" {
run -1 --separate-stderr timeout 2s "${CROWDSEC}" -no-api
# really needs 4 secs on slow boxes
run -1 --separate-stderr timeout 4s "${CROWDSEC}" -no-api
}
@test "crowdsec should not run without LAPI (no api.server in configuration file)" {
config_disable_lapi
run -1 --separate-stderr timeout 2s "${CROWDSEC}"
# really needs 4 secs on slow boxes
run -1 --separate-stderr timeout 4s "${CROWDSEC}"
run -0 echo "${stderr}"
assert_output --partial "crowdsec local API is disabled"

View file

@ -129,7 +129,7 @@ teardown() {
./instance-crowdsec start
fake_log >>"${tmpfile}"
sleep 1
sleep 2
rm -f -- "${tmpfile}"
run -0 --separate-stderr cscli decisions list -o json
run -0 jq -c '.[].decisions[0] | [.value,.type]' <(output)

View file

@ -37,7 +37,7 @@ teardown() {
./instance-crowdsec start
fake_log >>"${tmpfile}"
sleep 1
sleep 2
rm -f -- "${tmpfile}"
run -0 cscli decisions list -o json
run -0 jq -r '.[].decisions[0].value' <(output)

View file

@ -25,9 +25,10 @@ fi
port_number=$1
# 4 seconds may seem long, but the tests must work on embedded, slow arm boxes too
for _ in $(seq 40); do
nc -z localhost "${port_number}" >/dev/null 2>&1 && exit 0
sleep .03
sleep .1
done
# send to &3 if open