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

Commit eb4a5b5

Browse files
justinwraygsingh93
authored andcommitted
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.
1 parent ea78f6a commit eb4a5b5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

extra/run_tests.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/te
2020
mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/logos.sql;"
2121
mysql -u "$DB_USER" --password="$DB_PWD" "$DB" -e "source $CODE_PATH/database/countries.sql;"
2222

23+
if [ -f "$CODE_PATH/settings.ini" ]; then
24+
echo "[+] Backing up existing settings.ini"
25+
cp "$CODE_PATH/settings.ini" "$CODE_PATH/settings.ini.bak"
26+
fi
27+
2328
echo "[+] DB Connection file"
2429
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"
2530

@@ -30,6 +35,11 @@ echo "[+] Deleting test database"
3035
mysql -u "$DB_USER" --password="$DB_PWD" -e "DROP DATABASE IF EXISTS $DB;"
3136
mysql -u "$DB_USER" --password="$DB_PWD" -e "FLUSH PRIVILEGES;"
3237

38+
if [ -f "$CODE_PATH/settings.ini.bak" ]; then
39+
echo "[+] Restoring previous settings.ini"
40+
mv "$CODE_PATH/settings.ini.bak" "$CODE_PATH/settings.ini"
41+
fi
42+
3343
# In the future, we should use the hh_client exit status.
3444
# Current there are some PHP built-ins not found in the hhi files upstream in HHVM.
3545
echo "[+] Verifying HHVM Strict Compliance and Error Checking"

0 commit comments

Comments
 (0)