Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Backup and Restore settings.ini on Tests (#519)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
justinwray authored and gsingh93 committed Jun 6, 2017
1 parent ea78f6a commit eb4a5b5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions extra/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand Down

0 comments on commit eb4a5b5

Please sign in to comment.