From f2615873802b2fd66820be187d41a681d8b522ca Mon Sep 17 00:00:00 2001 From: Christian Hagemeier Date: Fri, 10 Jan 2025 17:02:20 +0000 Subject: [PATCH] Add failing proptest Adds a proptest that exposes (most likely) a bug in Mountpoint regarding the local content (a file that is created, but not open yet) of a directory being forgotten, if all of the remote content is deleted. Signed-off-by: Christian Hagemeier --- mountpoint-s3/tests/reftests/harness.rs | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/mountpoint-s3/tests/reftests/harness.rs b/mountpoint-s3/tests/reftests/harness.rs index 045362024..a2c204ebd 100644 --- a/mountpoint-s3/tests/reftests/harness.rs +++ b/mountpoint-s3/tests/reftests/harness.rs @@ -1308,6 +1308,7 @@ mod mutations { ) } + /* Ensure that local files are shadowed by the remote directories. */ @@ -1330,4 +1331,65 @@ mod mutations { 0, ) } + + + #[test] + fn regression_local_lost_when_removing_remote_entries() { + run_test(TreeNode::Directory(BTreeMap::from([])), vec![ + Op::CreateDirectory( + DirectoryIndex( + 0, + ), + ValidName( + "a".into(), + ), + ), + Op::CreateDirectory( + DirectoryIndex( + 0, + ), + ValidName( + "-".into(), + ), + ), + Op::WriteFile( + ValidName( + "a".into(), + ), + DirectoryIndex( + 1, + ), + FileContent( + 0, + FileSize::Small(0), + ), + ), + Op::CreateFile( + ValidName( + "aa".into(), + ), + DirectoryIndex( + 1, + ), + FileContent( + 0, + FileSize::Small(0), + ), + ), + Op::DeleteObject( + KeyIndex( + 0, + ), + ), + Op::CreateDirectory( + DirectoryIndex( + 0, + ), + ValidName( + "a".into(), + ), + ), + ], 0) + } + }