Skip to content

Commit

Permalink
Add failing proptest
Browse files Browse the repository at this point in the history
Adds a failing proptest, which occured as we did not remove inflight writes to a file, if it was overriden by a PutObject.
Signed-off-by: Christian Hagemeier <[email protected]>
  • Loading branch information
c-hagem committed Jan 15, 2025
1 parent 456c7de commit 04d5a73
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion mountpoint-s3/tests/reftests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,21 @@ impl Harness {
self.client.add_object(&key, object.clone());
self.reference.add_remote_key(&key, object);
// Any local directories along the path are made remote by adding this object
self.reference.remove_local_parents(key_as_path);
self.reference.remove_local_parents(key_as_path.clone());
// If we overwrite a file that is currently part of an inflight write

Check warning on line 580 in mountpoint-s3/tests/reftests/harness.rs

View workflow job for this annotation

GitHub Actions / Formatting

Diff in /home/runner/work/mountpoint-s3/mountpoint-s3/mountpoint-s3/tests/reftests/harness.rs
// we have to remove that inflight write, as otherwise we fail when opening the
// ino to continue writing.
let mut idx : i32 = -1;
for inflight_write in &self.inflight_writes.writes {
idx += 1;
if inflight_write.path == key_as_path {
break;
}
}

if idx != -1 {
self.inflight_writes.remove(InflightWriteIndex(idx as usize));
}
}

/// Perform a DeleteObject on the bucket, to simulate concurrent access to the bucket by a
Expand Down Expand Up @@ -1330,4 +1344,43 @@ mod mutations {
0,
)
}

#[test]
fn regression_stale_ino() {
run_test(
TreeNode::Directory(BTreeMap::from([])),

Check warning on line 1351 in mountpoint-s3/tests/reftests/harness.rs

View workflow job for this annotation

GitHub Actions / Formatting

Diff in /home/runner/work/mountpoint-s3/mountpoint-s3/mountpoint-s3/tests/reftests/harness.rs
vec![
Op::CreateFile(
ValidName(
"a".into(),
),
DirectoryIndex(
0,
),
FileContent(
0,
FileSize::Small(0),
),
),
Op::PutObject(
DirectoryIndex(
0,
),
Name(
"a/a".into(),
),
FileContent(
0,
FileSize::Small(0),
),
),
Op::FinishWrite(
InflightWriteIndex(
0,
),
),
],
0
);
}
}

0 comments on commit 04d5a73

Please sign in to comment.