Skip to content
Snippets Groups Projects
Commit 8f0517d4 authored by Brendan Masson's avatar Brendan Masson
Browse files

Allow overriding DB user in run_tests

parent e28ad724
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# This script is used to run tests on a database with demo data installed. # This script is used to run tests on a database with demo data installed.
# #
# Either provide the name of the database (first argument) or it will default to <project>_test # Either provide the name of the database (first argument) or it will default to <project>_test
# The DB user can be overriden by setting ODOO_SCRIPTS_DB_USER.
# Version 2.10 # Version 2.10
here=$(dirname $0) here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD) project_home=$(cd $here && cd .. && echo $PWD)
...@@ -21,6 +22,12 @@ ...@@ -21,6 +22,12 @@
fi fi
echo "Using database $dbname for tests" echo "Using database $dbname for tests"
if [[ -n "$ODOO_SCRIPTS_DB_USER" ]]
then
echo "Using db user $ODOO_SCRIPTS_DB_USER"
db_user_param="--db_user $ODOO_SCRIPTS_DB_USER"
fi
ODOO_TYPE=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print c.get('odoo_scripts', 'odoo_type', 'odoo8')") ODOO_TYPE=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print c.get('odoo_scripts', 'odoo_type', 'odoo8')")
if [ "$ODOO_TYPE" = "odoo8" ]; if [ "$ODOO_TYPE" = "odoo8" ];
then then
...@@ -29,7 +36,7 @@ ...@@ -29,7 +36,7 @@
loglevel="--log-level=test" loglevel="--log-level=test"
fi fi
logfile=$(tempfile --suffix=.log) logfile=$(tempfile --suffix=.log)
$here/start $update -d $dbname --test-enable $loglevel --max-cron=0 --stop-after-init $* | tee $logfile | sed -e 's/\(.*\) \(INFO\) \(.*\)/\o033[2m\1\o033[22m \o033[32m\o033[7m\2\o033[27m \3\o033[39m/' -e 's/\(.*\) \(DEBUG\) \(.*\)/\1 \o033[33m\o033[7m\2\o033[27m \2\o033[39m/' -e 's/\(.*\) \(WARNING\) \(.*\)/\o033[2m\1\o033[22m \o033[33m\o033[7m\2\o033[27m \3\o033[39m/' -e 's/\(.*\) \(ERROR\) \(.*\)/\1 \o033[31m\o033[7m\2\o033[27m \3\o033[0m/' -e 's/\(.*\) \(TEST\) \(.*\)/\1 \o033[34m\o033[7m\2\o033[27m \3 \o033[0m/' -e 's/ FAILED/ \o033[41m\o033[97m\o033[1mFAILED\o033[0m/' -e 's/ FAIL\(.*\)/ \o033[41m\o033[97m\o033[1mFAIL\o033[49m\o033[31m\1\o033[0m/' $here/start $update -d $dbname $db_user_param --test-enable $loglevel --max-cron=0 --stop-after-init $* | tee $logfile | sed -e 's/\(.*\) \(INFO\) \(.*\)/\o033[2m\1\o033[22m \o033[32m\o033[7m\2\o033[27m \3\o033[39m/' -e 's/\(.*\) \(DEBUG\) \(.*\)/\1 \o033[33m\o033[7m\2\o033[27m \2\o033[39m/' -e 's/\(.*\) \(WARNING\) \(.*\)/\o033[2m\1\o033[22m \o033[33m\o033[7m\2\o033[27m \3\o033[39m/' -e 's/\(.*\) \(ERROR\) \(.*\)/\1 \o033[31m\o033[7m\2\o033[27m \3\o033[0m/' -e 's/\(.*\) \(TEST\) \(.*\)/\1 \o033[34m\o033[7m\2\o033[27m \3 \o033[0m/' -e 's/ FAILED/ \o033[41m\o033[97m\o033[1mFAILED\o033[0m/' -e 's/ FAIL\(.*\)/ \o033[41m\o033[97m\o033[1mFAIL\o033[49m\o033[31m\1\o033[0m/'
ok=$(grep ' OK' $logfile -c) ok=$(grep ' OK' $logfile -c)
# TODO detect yaml tests failures # TODO detect yaml tests failures
failed=$(grep ' FAILED' $logfile -c) failed=$(grep ' FAILED' $logfile -c)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment