Allow databases to be preloaded
To speed up bootstrapping time for turbo-hipster, check if the database exists before creating it with the seed data as part of the job run. This allows us to preload the database (as part of a nodepool image build) which will save a lot of time. Change-Id: Ieb09e714e24fe6df3ce148e44d5c1148739751c0
This commit is contained in:
parent
e946029b5e
commit
2855d34f02
@ -244,11 +244,13 @@ which mkvirtualenv
|
||||
set +x
|
||||
|
||||
# Restore database to known good state
|
||||
echo "Restoring test database $DB_NAME"
|
||||
echo "Loading test database $DB_NAME"
|
||||
set -x
|
||||
mysql -u $DB_USER --password=$DB_PASS -e "drop database $DB_NAME"
|
||||
mysql -u $DB_USER --password=$DB_PASS -e "create database $DB_NAME"
|
||||
mysql -u $DB_USER --password=$DB_PASS $DB_NAME < $DATASET_SEED_SQL
|
||||
if ! mysql -u $DB_USER --password=$DB_PASS -e 'use $DB_NAME'
|
||||
then
|
||||
mysql -u $DB_USER --password=$DB_PASS -e "create database $DB_NAME"
|
||||
mysql -u $DB_USER --password=$DB_PASS $DB_NAME < $DATASET_SEED_SQL
|
||||
fi
|
||||
set +x
|
||||
|
||||
echo "Build test environment"
|
||||
|
Loading…
x
Reference in New Issue
Block a user