0667552132
* split CI/bats in sqlite+mysql+mariadb+hub * renamed db and user 'crowdsec' to 'crowdsec-test'; moved backend-specific scripts to lib/db, etc. * postgres tests * force delay between ipv6 tests (for myisam) * force delay after pg_restore to ensure data is written
38 lines
896 B
Bash
Executable file
38 lines
896 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
die() {
|
|
echo >&2 "$@"
|
|
exit 1
|
|
}
|
|
|
|
# shellcheck disable=SC1007
|
|
TEST_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
# shellcheck source=./.environment.sh
|
|
. "${TEST_DIR}/.environment.sh"
|
|
|
|
"${TEST_DIR}/check-requirements"
|
|
|
|
echo "Running tests..."
|
|
echo "DB_BACKEND: $DB_BACKEND"
|
|
|
|
dump_backend="$(cat "${LOCAL_INIT_DIR}/.backend")"
|
|
if [ "$DB_BACKEND" != "$dump_backend" ]; then
|
|
die "Can't run with backend '$DB_BACKEND' because the test data was build with '$dump_backend'"
|
|
fi
|
|
|
|
if [ $# -ge 1 ]; then
|
|
echo "test files: $*"
|
|
"${TEST_DIR}/lib/bats-core/bin/bats" \
|
|
--jobs 1 \
|
|
--print-output-on-failure \
|
|
-T "$@"
|
|
else
|
|
echo "test files: ${TEST_DIR}/bats ${TEST_DIR}/dyn-bats"
|
|
"${TEST_DIR}/lib/bats-core/bin/bats" \
|
|
--jobs 1 \
|
|
--print-output-on-failure \
|
|
-T "${TEST_DIR}/bats" "${TEST_DIR}/dyn-bats"
|
|
fi
|