mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-05-04 05:30:33 +08:00
- specify database host in the environment - run migration test on current database instead of iterating over all Signed-off-by: Michal Čihař <michal@cihar.com>
31 lines
925 B
Text
31 lines
925 B
Text
# shell library to help executing tests
|
|
|
|
set -x
|
|
coverage erase
|
|
|
|
check() {
|
|
RET=$?
|
|
if [ $RET -ne 0 ] ; then
|
|
exit $RET
|
|
fi
|
|
}
|
|
|
|
run_coverage() {
|
|
python -W default -W ignore:unclosed:ResourceWarning -m coverage run --source . --append "$@"
|
|
}
|
|
|
|
cleanup_database() {
|
|
rm -f weblate.db
|
|
|
|
if [ $CI_DATABASE = "mysql" ] ; then
|
|
mysql --host=$CI_DB_HOST -e 'SET GLOBAL character_set_server=utf8' -uroot
|
|
mysql --host=$CI_DB_HOST -e 'SET GLOBAL collation_server=utf8_general_ci' -uroot
|
|
mysql --host=$CI_DB_HOST -e 'DROP DATABASE IF EXISTS weblate;' -uroot
|
|
mysql --host=$CI_DB_HOST -e 'CREATE DATABASE weblate CHARACTER SET utf8 COLLATE utf8_general_ci;' -uroot
|
|
fi
|
|
|
|
if [ $CI_DATABASE = "postgresql" ] ; then
|
|
psql --host=$CI_DB_HOST -c 'DROP DATABASE IF EXISTS weblate;' -U postgres
|
|
psql --host=$CI_DB_HOST -c 'CREATE DATABASE weblate;' -U postgres
|
|
fi
|
|
}
|