From c9a63657f6ca46dd1e6689726e4f12bdd521be83 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Tue, 15 Jul 2014 13:54:25 -0400 Subject: [PATCH 1/2] Check to make sure that the mysql service is running. --- pavelib/utils/test/bokchoy_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pavelib/utils/test/bokchoy_utils.py b/pavelib/utils/test/bokchoy_utils.py index 224b589457..368a96ea60 100644 --- a/pavelib/utils/test/bokchoy_utils.py +++ b/pavelib/utils/test/bokchoy_utils.py @@ -127,8 +127,8 @@ def is_mysql_running(): """ # We use the MySQL CLI client and capture its stderr # If the client cannot connect successfully, stderr will be non-empty - output = os.popen('mysql -e "" 2>&1').read() - return output == "" + output = os.popen('status mysql 2>&1').read() + return output.startswith("mysql start/running, process") def clear_mongo(): From 22b97338c9203e804dd1b84a91f1ccc08174d6cf Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Tue, 15 Jul 2014 13:55:18 -0400 Subject: [PATCH 2/2] Create the test database if it doesn't exist. There is a bootstrapping case where the test DB doesn't exist which causes reset_db to fail. --- scripts/reset-test-db.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/reset-test-db.sh b/scripts/reset-test-db.sh index a0808c208a..42d8d69e8d 100755 --- a/scripts/reset-test-db.sh +++ b/scripts/reset-test-db.sh @@ -24,6 +24,9 @@ DB_CACHE_DIR="common/test/db_cache" +# Ensure the test database exists. +echo "CREATE DATABASE IF NOT EXISTS test;" | mysql -u root + # Clear out the test database ./manage.py lms --settings bok_choy reset_db --traceback --noinput