Xuanwo commented on code in PR #2644: URL: https://github.com/apache/incubator-opendal/pull/2644#discussion_r1263564849
########## core/tests/behavior/write.rs: ########## @@ -1233,3 +1234,31 @@ pub async fn test_fuzz_unsized_writer(op: Operator) -> Result<()> { op.delete(&path).await.expect("delete must succeed"); Ok(()) } + +/// seeking a negative position should return a InvalidInput error +pub async fn test_invalid_reader_seek(op: Operator) -> Result<()> { + let path = uuid::Uuid::new_v4().to_string(); + debug!("Generate a random file: {}", &path); + let (content, _) = gen_bytes(); + + op.write(&path, content.clone()) + .await + .expect("write must succeed"); + + let mut r = op.reader(&path).await?; + let res = r.seek(std::io::SeekFrom::Current(-1024)).await; + + assert!(res.is_err()); + + // the res should be a std::io::Error, which contains a ErrorKind::InvalidInput Review Comment: We can add in this PR directly -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org