Skip to content

Commit 36eb3f4

Browse files
add test to confirm unlink/remove behavior
1 parent 62299e4 commit 36eb3f4

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

runtime/src/storage/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ pub(crate) mod tests {
305305
test_read_at_buf_returns_same_buffer(&storage).await;
306306
test_read_at_buf_insufficient_capacity(&storage).await;
307307
test_read_at_buf_larger_capacity(&storage).await;
308+
test_read_after_remove(&storage).await;
308309
}
309310

310311
/// Test opening a blob, writing to it, and reading back the data.
@@ -342,6 +343,25 @@ pub(crate) mod tests {
342343
assert!(blobs.is_empty(), "Blob was not removed as expected");
343344
}
344345

346+
/// Test that existing blob handles remain readable after the blob is removed from storage.
347+
async fn test_read_after_remove<S>(storage: &S)
348+
where
349+
S: Storage + Send + Sync,
350+
S::Blob: Send + Sync,
351+
{
352+
let (blob, _) = storage.open("read_after_remove", b"blob").await.unwrap();
353+
blob.write_at(0, b"still here").await.unwrap();
354+
blob.sync().await.unwrap();
355+
356+
storage
357+
.remove("read_after_remove", Some(b"blob"))
358+
.await
359+
.unwrap();
360+
361+
let read = blob.read_at(0, 10).await.unwrap();
362+
assert_eq!(read.coalesce(), b"still here");
363+
}
364+
345365
/// Test scanning a partition for blobs.
346366
async fn test_scan<S>(storage: &S)
347367
where

0 commit comments

Comments
 (0)