Skip to content

Commit

Permalink
fix overflow UT
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxa21 committed Jun 18, 2024
1 parent a88d3fc commit 07035bb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/object_store/src/object/opendal_engine/opendal_object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,23 @@ mod tests {
let bytes = store.read("/abc", 4..6).await.unwrap();
assert_eq!(String::from_utf8(bytes.to_vec()).unwrap(), "56".to_string());

// Overflow.
store.read("/abc", 4..44).await.unwrap_err();

store.delete("/abc").await.unwrap();

// No such object.
store.read("/abc", 0..3).await.unwrap_err();
}

#[tokio::test]
#[should_panic]
async fn test_memory_read_overflow() {
let block = Bytes::from("123456");
let store = OpendalObjectStore::test_new_memory_engine().unwrap();
store.upload("/abc", block).await.unwrap();

// Overflow.
store.read("/abc", 4..44).await.unwrap_err();
}

#[tokio::test]
async fn test_memory_metadata() {
let block = Bytes::from("123456");
Expand Down

0 comments on commit 07035bb

Please sign in to comment.