Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(backup): Create backup version snapshot tests (#58173)
The goal for the export.json feature is to support two minor versions (since we're using CalVer, roughly equivalent to two months) of releases when importing. That is to say, if the latest release is 23.10.0, and the previous two releases were 23.9.0 and 23.8.0, then a self-hosted release running code from [email protected] or self-hosted@latest (aka nightly) should be able to successfully import JSON backup data generated by [email protected] and [email protected], but not necessarily [email protected]. To support this, we add a new file `test_releases.py` that provides a snapshot test of an "exhaustive" (aka, has at least one of every exportable model) export. Every time we cut a new release, we will add a new commit directly after the release commit that renames the `test_at_head` snapshot to `test_at_<RELEASED_VERSION>`, and creates a test case for that version (see `test_at_23_9_1` in this PR for one such example). Test cases older than the 2 version support window will simultaneously be removed. In the future, we plan to automate this "release test rotation" process via GitHub actions, but for now the ospo team will take care to do this manually for every release. Some other notes of interest: - Exports cannot be compared for equality using simple string comparisons, since they have special comparators for cases like passwords, dates that may or may not have been updated, etc (see comparators.py for greater detail). To accommodate this, we extend the `insta_snapshot` fixture with an extra argument, `inequality_comparator`, that allows a custom comparison lambda to be passed in for such cases. - The `test_at_23_9_1` snapshot was generated by taking an early version of this PR, cherry-picking it onto the `23.9.1` release tag, generating a new snapshot there, then copying the result back into the main commit. Closes getsentry/team-ospo#197
- Loading branch information