This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch fix-stat
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/fix-stat by this push:
new ab738e3b2 FIx test
ab738e3b2 is described below
commit ab738e3b2f1e8435da2813489fa41107d105bae8
Author: Xuanwo <[email protected]>
AuthorDate: Thu Nov 23 01:45:35 2023 +0800
FIx test
Signed-off-by: Xuanwo <[email protected]>
---
core/tests/behavior/blocking_write.rs | 12 ++++++++++++
core/tests/behavior/write.rs | 12 +++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/core/tests/behavior/blocking_write.rs
b/core/tests/behavior/blocking_write.rs
index 25442a62f..164af2536 100644
--- a/core/tests/behavior/blocking_write.rs
+++ b/core/tests/behavior/blocking_write.rs
@@ -58,6 +58,10 @@ pub fn behavior_blocking_write_tests(op: &Operator) ->
Vec<Trial> {
/// Create dir with dir path should succeed.
pub fn test_blocking_create_dir(op: BlockingOperator) -> Result<()> {
+ if !op.info().full_capability().stat_dir {
+ return Ok(());
+ }
+
let path = format!("{}/", uuid::Uuid::new_v4());
op.create_dir(&path)?;
@@ -71,6 +75,10 @@ pub fn test_blocking_create_dir(op: BlockingOperator) ->
Result<()> {
/// Create dir on existing dir should succeed.
pub fn test_blocking_create_dir_existing(op: BlockingOperator) -> Result<()> {
+ if !op.info().full_capability().stat_dir {
+ return Ok(());
+ }
+
let path = format!("{}/", uuid::Uuid::new_v4());
op.create_dir(&path)?;
@@ -155,6 +163,10 @@ pub fn test_blocking_stat_file(op: BlockingOperator) ->
Result<()> {
/// Stat existing file should return metadata
pub fn test_blocking_stat_dir(op: BlockingOperator) -> Result<()> {
+ if !op.info().full_capability().stat_dir {
+ return Ok(());
+ }
+
let path = format!("{}/", uuid::Uuid::new_v4());
op.create_dir(&path).expect("write must succeed");
diff --git a/core/tests/behavior/write.rs b/core/tests/behavior/write.rs
index 699c651f1..056b8cdea 100644
--- a/core/tests/behavior/write.rs
+++ b/core/tests/behavior/write.rs
@@ -115,6 +115,10 @@ pub async fn test_create_dir(op: Operator) -> Result<()> {
/// Create dir on existing dir should succeed.
pub async fn test_create_dir_existing(op: Operator) -> Result<()> {
+ if !op.info().full_capability().stat_dir {
+ return Ok(());
+ }
+
let path = format!("{}/", uuid::Uuid::new_v4());
op.create_dir(&path).await?;
@@ -397,9 +401,11 @@ pub async fn test_stat_not_exist(op: Operator) ->
Result<()> {
assert_eq!(meta.unwrap_err().kind(), ErrorKind::NotFound);
// Stat not exist dir should also returns NotFound.
- let meta = op.stat(&format!("{path}/")).await;
- assert!(meta.is_err());
- assert_eq!(meta.unwrap_err().kind(), ErrorKind::NotFound);
+ if op.info().full_capability().stat_dir {
+ let meta = op.stat(&format!("{path}/")).await;
+ assert!(meta.is_err());
+ assert_eq!(meta.unwrap_err().kind(), ErrorKind::NotFound);
+ }
Ok(())
}