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

test: add backup integration tests using snapshots #175

Merged
merged 52 commits into from
Mar 13, 2024
Merged

Conversation

aawsome
Copy link
Member

@aawsome aawsome commented Mar 5, 2024

This PR adds some integration tests (mostly inspired by restic's integration tests). We use insta for "snapshotting" internal state and then compare against it depending on which operating system we are on.

@aawsome aawsome changed the title tests: Add integration tests WIP tests: Add integration tests Mar 5, 2024
@aawsome aawsome changed the title WIP tests: Add integration tests WIP test: Add integration tests Mar 5, 2024
@aawsome aawsome force-pushed the integration-tests branch 2 times, most recently from 07b6917 to 14d701e Compare March 6, 2024 10:09
Copy link

codecov bot commented Mar 9, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@simonsan simonsan added this to the NEXT milestone Mar 12, 2024
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
Signed-off-by: simonsan <[email protected]>
@simonsan simonsan changed the title WIP test: Add integration tests test: add backup integration tests using snapshots Mar 13, 2024
simonsan
simonsan previously approved these changes Mar 13, 2024
@simonsan simonsan added this pull request to the merge queue Mar 13, 2024
@simonsan simonsan removed this pull request from the merge queue due to a manual request Mar 13, 2024
@simonsan
Copy link
Contributor

Wanted to merge it, to test out the new merge queue CI, but maybe you also want to have a look before @aawsome? Especially if the numbers are plausible.

I reworked the integration test, so we have ron snapshots, because redactions were not possible in debug snapshots. But I think redactions can become useful going forward, also because the code is more structured. I passed in everything via dependency injection due to rstest's fixtures. I think that also gives a better overview, of what's actually being used in the function (after getting used to it).

In addition: I factored out the redaction settings to their own fixtures as well, to make them reusable and easier to administer. I also wrote some comments on the top of the integration test file for some explanations.

I think it's a good foundation for future integration tests. Furthermore, I do think we can add a few more, like these. For example, making sure, that backing up a directory and then a second time actually changes the files_modified and files_new fields, etc. But for now I think it's fine, and we should test more fine grainer (e.g. unit testing for PathList and others) to make sure, the basics are right on each plattform.

@simonsan simonsan added A-testing Area: Testing and coverage C-enhancement Category: New feature or request labels Mar 13, 2024
Copy link
Member Author

@aawsome aawsome left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks a lot @simonsan for overworking!

@simonsan simonsan added this pull request to the merge queue Mar 13, 2024
Merged via the queue into main with commit 6585cb9 Mar 13, 2024
30 checks passed
@simonsan simonsan deleted the integration-tests branch March 13, 2024 10:09
@simonsan simonsan mentioned this pull request Mar 13, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 18, 2024
## 🤖 New release
* `rustic_backend`: 0.1.1 -> 0.2.0 (✓ API compatible changes)
* `rustic_core`: 0.2.0 -> 0.3.0 (✓ API compatible changes)
* `rustic_config`: 0.1.0 -> 0.2.0 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `rustic_backend`
<blockquote>

##
[0.2.0](rustic_backend-v0.1.1...rustic_backend-v0.2.0)
- 2024-08-18

### Added
- *(backends)* Add throttle option to opendal backend
([#216](#216))
- *(backend)* [**breaking**] remove s3 and sftp wrapper around opendal
([#200](#200))
- [**breaking**] move clippy lints to cargo manifest and fix upcoming
issues all over the workspace
([#176](#176))
- *(opendal)* Add option connections
([#155](#155))

### Fixed
- clippy lints
([#220](#220))
- *(backends)* local: Only create repo dir when creating the repository
([#206](#206))
- *(deps)* update rust crate reqwest to 0.11.26
([#196](#196))
- *(deps)* update rust crate thiserror to 1.0.58
([#192](#192))
- *(deps)* update rust crate anyhow to 1.0.81
([#191](#191))
- *(rclone)* Use semver for version checking
([#188](#188))
- *(deps)* update rust crate clap to 4.5.2
([#183](#183))
- *(config)* Merge repository options for multiple config sources
([#171](#171))
- *(backend)* Give useful error message when no repository is given.
- updated msrv and fix clippy lints
([#160](#160))

### Other
- dependency updates
- *(deps)* more version updates
([#237](#237))
- Update MSRV to 1.76.0
- *(deps)* Several version updates
([#234](#234))
- Update MSRV (needed by opendal)
- update opendal to 0.46 and refactor accordingly
([#225](#225))
- Update MSRV to 1.73.0
- fix clippy lints
- *(deps)* update dependencies
([#180](#180))
- add rustic_testing to workspace crates
- reset again after release to workspace dependencies for workspace
crates
</blockquote>

## `rustic_core`
<blockquote>

##
[0.3.0](rustic_core-v0.2.0...rustic_core-v0.3.0)
- 2024-08-18

### Added
- *(forget)* [**breaking**] Make keep-* Options and add keep-none
([#238](#238))
- add search methods to Repository
([#212](#212))
- [**breaking**] Allow specifying many options in config profile without
array ([#211](#211))
- [**breaking**] move clippy lints to cargo manifest and fix upcoming
issues all over the workspace
([#176](#176))
- Add extra check before writing data
([#154](#154))
- Allow missing fields in snapshot summary
- Hide plain text password from help text
([#170](#170))
- Add Repository::to_indexed_checked and ::to_index_ids_checked()
([#168](#168))
- *(prune)* Add more debug info to stats
([#162](#162))
- Add append-only repository mode
([#164](#164))

### Fixed
- parse commands given by arg or env using shell_words
([#240](#240))
- Allow non-value/null xattr
([#235](#235))
- ensure Rust 1.76.0 compiles
- backup file even if failed listing extended attributes
([#233](#233))
- Export types so the Repository type can be fully specified
([#229](#229))
- Always sort StringList
([#226](#226))
- *(commands)* Properly finish progress bars
- *(commands)* [**breaking**] Fix edge case for repair index
([#219](#219))
- clippy lints
([#220](#220))
- *(errors)* Show filenames in error message coming from ignore source
([#215](#215))
- *(paths)* Handle paths starting with "." correctly
([#213](#213))
- Add warning about unsorted files and sort where neccessary
([#205](#205))
- *(deps)* update rust crate thiserror to 1.0.58
([#192](#192))
- *(deps)* update rust crate anyhow to 1.0.81
([#191](#191))
- *(deps)* update rust crate serde_with to 3.7.0
([#189](#189))
- *(rclone)* Use semver for version checking
([#188](#188))
- *(deps)* update rust crate strum to 0.26.2
([#187](#187))
- *(deps)* update rust crate clap to 4.5.2
([#183](#183))
- Set correct content for symlink with parent snapshot
([#174](#174))
- update dependency nix
([#169](#169))
- *(memory)* Limit memory usage for restore when having large pack files
([#165](#165))
- *(prune)* Correct number of repacks
([#167](#167))
- updated msrv and fix clippy lints
([#160](#160))

### Other
- dependency updates
- Ensure that MSRV 1.76 works
- *(deps)* more version updates
([#237](#237))
- Update MSRV to 1.76.0
- *(deps)* Several version updates
([#234](#234))
- fix clippy lints
([#236](#236))
- Update MSRV (needed by opendal)
- update sha2 dependency
- add integration tests for `prune` and `ls`
([#221](#221))
- *(error)* Add error sources
([#217](#217))
- add more warnings
- make SnapshotFile::cmp_group public
([#210](#210))
- Update MSRV to 1.73.0
- fix clippy lints
- add backup integration tests using snapshots
([#175](#175))
- replace dep bitmask-enum by enumset
([#173](#173))
- *(deps)* update dependencies
([#180](#180))
- use release-plz action, remove public api fixtures incl. test and
related ci and other release related ci
- Add unit tests for extra verification
([#172](#172))
- rustic_config v0.1.0
- add rustic_testing to workspace crates
</blockquote>

## `rustic_config`
<blockquote>

##
[0.2.0](rustic_config-v0.1.0...rustic_config-v0.2.0)
- 2024-08-18

### Added
- [**breaking**] move clippy lints to cargo manifest and fix upcoming
issues all over the workspace
([#176](#176))

### Other
- Update MSRV to 1.76.0
- Update MSRV (needed by opendal)
- Update MSRV to 1.73.0
- add changelog for rustic_config
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Signed-off-by: simonsan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testing Area: Testing and coverage C-enhancement Category: New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants