mysql test: delays in strem test (#1387)

This commit is contained in:
mmetc 2022-03-24 14:50:52 +01:00 committed by GitHub
parent aef62f74f8
commit 7329a9d4b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -37,24 +37,24 @@ api() {
@test "$FILE stream start" {
run -0 api "/v1/decisions/stream?startup=true"
[[ "$DB_BACKEND" == "mysql" ]] && sleep 3
run -0 jq -r '.new' <(output)
assert_output --partial '1111:2222:3333:4444:5555:6666:7777:8888'
assert_output --partial '1.2.3.4'
assert_output --partial '1.2.4.0/24'
}
@test "$FILE stream cont (add)" {
sleep 1
run -0 cscli decisions add -i '1.2.3.5'
[[ "$DB_BACKEND" == "mysql" ]] && sleep 3
run -0 api "/v1/decisions/stream"
run -0 jq -r '.new' <(output)
assert_output --partial '1.2.3.5'
}
@test "$FILE stream cont (del)" {
sleep 1
run -0 cscli decisions delete -i '1.2.3.4'
[[ "$DB_BACKEND" == "mysql" ]] && sleep 3
run -0 api "/v1/decisions/stream"
run -0 jq -r '.deleted' <(output)
assert_output --partial '1.2.3.4'

View file

@ -78,7 +78,8 @@ restore() {
"--port=${MYSQL_PORT}" \
"--password=${MYSQL_PASSWORD}" < "$backup_file"
exec_sql "CREATE USER IF NOT EXISTS 'crowdsec_test' IDENTIFIED BY 'crowdsec_test';"
exec_sql "DROP USER IF EXISTS 'crowdsec_test';"
exec_sql "CREATE USER 'crowdsec_test' IDENTIFIED BY 'crowdsec_test';"
exec_sql "GRANT ALL PRIVILEGES ON crowdsec_test.* TO 'crowdsec_test';"
}