From eb4a5b5e0e4eef73a8abecfaa1fb182613af147c Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Tue, 6 Jun 2017 16:06:09 -0400 Subject: [PATCH] Backup and Restore settings.ini on Tests (#519) * If `settings.ini` exists it will now be copied to `settings.ini.bak` during the testing process (/extra/run_tests.sh). * After the tests complete, if the backup file exists it will restore the file. --- extra/run_tests.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extra/run_tests.sh b/extra/run_tests.sh index 0144aee7..719680a9 100755 --- a/extra/run_tests.sh +++ b/extra/run_tests.sh @@ -20,6 +20,11 @@ mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/te mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/logos.sql;" mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/countries.sql;" +if [ -f "$CODE_PATH/settings.ini" ]; then + echo "[+] Backing up existing settings.ini" + cp "$CODE_PATH/settings.ini" "$CODE_PATH/settings.ini.bak" +fi + echo "[+] DB Connection file" cat "$CODE_PATH/extra/settings.ini.example" | sed "s/DATABASE/$DB/g" | sed "s/MYUSER/$DB_USER/g" | sed "s/MYPWD/$DB_PWD/g" > "$CODE_PATH/settings.ini" @@ -30,6 +35,11 @@ echo "[+] Deleting test database" mysql -u "$DB_USER" --password="$DB_PWD" -e "DROP DATABASE IF EXISTS $DB;" mysql -u "$DB_USER" --password="$DB_PWD" -e "FLUSH PRIVILEGES;" +if [ -f "$CODE_PATH/settings.ini.bak" ]; then + echo "[+] Restoring previous settings.ini" + mv "$CODE_PATH/settings.ini.bak" "$CODE_PATH/settings.ini" +fi + # In the future, we should use the hh_client exit status. # Current there are some PHP built-ins not found in the hhi files upstream in HHVM. echo "[+] Verifying HHVM Strict Compliance and Error Checking"