Skip to content

Commit

Permalink
use insta redactions to hide changing data
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Mar 13, 2024
1 parent f5c4dfd commit 6bc24c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ xattr = "1"
[dev-dependencies]
expect-test = "1.4.1"
flate2 = "1.0.28"
insta = "1.36.1"
insta = { version = "1.36.1", features = ["redactions"] }
mockall = "0.12.1"
pretty_assertions = "1.4.0"
quickcheck = "1.0.3"
Expand Down
32 changes: 28 additions & 4 deletions crates/core/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,22 @@ fn test_backup_with_tar_gz_passes(
let tree = repo.get_tree(&tree.subtree.expect("Sub tree"))?;

#[cfg(windows)]
assert_debug_snapshot!("backup-tar-tree-windows", tree);
assert_debug_snapshot!("backup-tar-tree-windows", tree,
{
"inode" => "inode",
"ctime" => "ctime",
"mtime" => "mtime",
"atime" => "atime",
});

#[cfg(not(windows))]
assert_debug_snapshot!("backup-tar-tree-nix", tree);
assert_debug_snapshot!("backup-tar-tree-nix", tree,
{
"inode" => "inode",
"ctime" => "ctime",
"mtime" => "mtime",
"atime" => "atime",
});

// get all snapshots and check them
let all_snapshots = repo.get_all_snapshots()?;
Expand Down Expand Up @@ -216,10 +228,22 @@ fn test_backup_dry_run_with_tar_gz_passes(
let tree = repo.get_tree(&tree.subtree.expect("Sub tree"))?;

#[cfg(windows)]
assert_debug_snapshot!("dryrun-tar-tree-windows", tree);
assert_debug_snapshot!("dryrun-tar-tree-windows", tree,
{
"inode" => "inode",
"ctime" => "ctime",
"mtime" => "mtime",
"atime" => "atime",
});

#[cfg(not(windows))]
assert_debug_snapshot!("dryrun-tar-tree-nix", tree);
assert_debug_snapshot!("dryrun-tar-tree-nix", tree,
{
"inode" => "inode",
"ctime" => "ctime",
"mtime" => "mtime",
"atime" => "atime",
});

// re-read index
let repo = repo.to_indexed_ids()?;
Expand Down

0 comments on commit 6bc24c3

Please sign in to comment.