mirror of
https://github.com/getsentry/self-hosted.git
synced 2026-02-06 10:57:17 +00:00
Add backup/restore integration tests (#2012)
* add backup/restore integration tests
This commit is contained in:
parent
e68bd5b460
commit
d8176e94d5
34
_integration-test/ensure-backup-restore-works.sh
Executable file
34
_integration-test/ensure-backup-restore-works.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
source install/_lib.sh
|
||||
source install/dc-detect-version.sh
|
||||
|
||||
echo "${_group}Test that backup/restore works..."
|
||||
echo "Creating backup..."
|
||||
# Docker was giving me permissioning issues when trying to create this file and write to it even after giving read + write access
|
||||
# to group and owner. Instead, try creating the empty file and then give everyone write access to the backup file
|
||||
touch $(pwd)/sentry/backup.json
|
||||
chmod 666 $(pwd)/sentry/backup.json
|
||||
# Command here matches exactly what we have in our docs https://develop.sentry.dev/self-hosted/backup/#backup
|
||||
docker-compose run -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json
|
||||
# Check to make sure there is content in the file
|
||||
if [ ! -s "$(pwd)/sentry/backup.json" ]; then
|
||||
echo "Backup file is empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Bring postgres down and recreate the docker volume
|
||||
docker-compose stop postgres
|
||||
sleep 5
|
||||
docker-compose rm -f -v postgres
|
||||
docker volume rm sentry-postgres
|
||||
export SKIP_USER_CREATION=1
|
||||
source install/create-docker-volumes.sh
|
||||
source install/set-up-and-migrate-database.sh
|
||||
docker-compose up -d
|
||||
|
||||
echo "Importing backup..."
|
||||
docker-compose run --rm -T web import /etc/sentry/backup.json
|
||||
|
||||
rm $(pwd)/sentry/backup.json
|
||||
@ -10,6 +10,7 @@ echo "Testing initial install"
|
||||
./install.sh
|
||||
_integration-test/run.sh
|
||||
_integration-test/ensure-customizations-not-present.sh
|
||||
_integration-test/ensure-backup-restore-works.sh
|
||||
|
||||
echo "Make customizations"
|
||||
cat <<EOT >sentry/enhance-image.sh
|
||||
@ -25,3 +26,4 @@ echo "Testing in-place upgrade and customizations"
|
||||
./install.sh --minimize-downtime
|
||||
_integration-test/run.sh
|
||||
_integration-test/ensure-customizations-work.sh
|
||||
_integration-test/ensure-backup-restore-works.sh
|
||||
|
||||
Loading…
Reference in New Issue
Block a user