From 6bc24c3c6b9bb445c2672723cdf832b3e21a742d Mon Sep 17 00:00:00 2001 From: simonsan <14062932+simonsan@users.noreply.github.com> Date: Wed, 13 Mar 2024 02:50:47 +0100 Subject: [PATCH] use insta redactions to hide changing data Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com> --- crates/core/Cargo.toml | 2 +- crates/core/tests/integration.rs | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index ecdffa76..8cb3bee2 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -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" diff --git a/crates/core/tests/integration.rs b/crates/core/tests/integration.rs index ffcf8b01..c0ef89ed 100644 --- a/crates/core/tests/integration.rs +++ b/crates/core/tests/integration.rs @@ -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()?; @@ -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()?;