-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add backup/restore integration tests #2012
Changes from 6 commits
c5fdd9c
016acdc
bac94f6
280bf73
239d815
c730f19
755653e
163d895
c347e18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/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..." | ||
backup_path="$(pwd)/sentry/backup" | ||
mkdir -p $backup_path | ||
# 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 $backup_path/backup.json | ||
chmod 666 $backup_path/backup.json | ||
$dcr -v $backup_path:/sentry-data/backup -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 "$backup_path/backup.json" ]; then | ||
echo "Backup file is empty" | ||
exit 1 | ||
fi | ||
|
||
# bring postgres down and recreate the docker volume | ||
$dc stop postgres | ||
sleep 5 | ||
$dc 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 | ||
$dc up -d | ||
|
||
# echo "Importing backup..." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. echo? |
||
$dcr --rm -T web import /etc/sentry/backup/backup.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This matches the docs basically. Fine to use $dcr I guess vs. writing it out (like in the docs) if $dcr is necessary to get the test infra to work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not necessary to get it to work, For this use case I can use the exact command the docs is using |
||
|
||
rm $(pwd)/sentry/backup/backup.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little goofy that we have to call this twice, but I guess that's where we're at and we clean up the test suite under getsentry/team-ospo#91. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to see this match the docs exactly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a comment saying as much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can't get it exactly like the docs that's fine, just say so in the comment.