Added test to update the database schema to the latest revision

If developer make a mistake in a migration script that CI doesn't show
the error. This patch fixed it adding execution of upgrade database
command before PostgreSQL and MySQL tests.

Closes-Bug: #1611036
Change-Id: I641e39da6a66528e940a1924ba9c4797bbaa2a11
Signed-off-by: Vitalii Solodilov <mcdkr@yandex.ru>
This commit is contained in:
Vitalii Solodilov 2018-05-13 23:36:56 +04:00 committed by Dougal Matthews
parent 6652a01efc
commit fac2c4ac61
1 changed files with 12 additions and 0 deletions

View File

@ -158,6 +158,17 @@ function setup_db_cfg {
esac
}
function upgrade_db {
case ${db_type} in
"postgresql" | "mysql" )
mistral-db-manage --config-file .mistral.conf upgrade head
;;
*)
echo "Skip a database upgrade"
;;
esac
}
function cleanup {
rm -f .mistral.conf
}
@ -282,6 +293,7 @@ fi
setup_db_pylib
setup_db_cfg
upgrade_db
run_tests
# NOTE(sirp): we only want to run pep8 when we're running the full-test suite,