Skip to content
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

Merged

Conversation

hubertdeng123
Copy link
Member

@hubertdeng123 hubertdeng123 commented Mar 4, 2023

closes #1918

Since there is a unit test in sentry already covering backup/restore, this is a more broad test. It tests these functionalities

  1. Backup/restore is correctly writing any sort of data to the backup.json file.
  2. The export command doesn't throw an exception
  3. The import command doesn't throw an exception


echo "${_group}Test that backup/restore works..."
echo "Creating backup..."
$dcr -v $(pwd)/sentry:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json
Copy link
Member

@BYK BYK Mar 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need an ownership/permission set here. I suggest something like this:

mkdir $(pwd)/sentry/backup
chmod +w $(pwd)/sentry/backup
$dcr -v $(pwd)/sentry/backup:/sentry-data/backup --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export /sentry-data/backup/backup.json

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Darn looks like that isn't working, will play around and see if I can figure something out. Script seems to run fine locally though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, write access for group + owner wasn't enough. I needed write access for all users

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because the user and group IDs are different when running the sentry container (from the one GitHub actions bash script runner)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because the user and group IDs are different when running the sentry container (from the one GitHub actions bash script runner)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah that makes sense

@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/add-backup-restore-integration-test branch from 59a795e to 280bf73 Compare March 6, 2023 20:32
@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/add-backup-restore-integration-test branch from 438c722 to 239d815 Compare March 6, 2023 20:36
@hubertdeng123 hubertdeng123 marked this pull request as ready for review March 6, 2023 22:02
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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.

source install/set-up-and-migrate-database.sh
$dc up -d

# echo "Importing backup..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo?

# 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
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

$dc up -d

# echo "Importing backup..."
$dcr --rm -T web import /etc/sentry/backup/backup.json
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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

@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/add-backup-restore-integration-test branch 2 times, most recently from 90f2c7e to e886bb8 Compare March 7, 2023 01:05
@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/add-backup-restore-integration-test branch from e886bb8 to 755653e Compare March 7, 2023 01:15
@hubertdeng123 hubertdeng123 merged commit d8176e9 into master Mar 7, 2023
@hubertdeng123 hubertdeng123 deleted the hubertdeng123/add-backup-restore-integration-test branch March 7, 2023 17:47
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add integration tests for backup/restore workflow
3 participants