Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Jan 2, 2025
1 parent bd255c7 commit ee02fe4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions core/src/services/s3/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ impl oio::PageList for S3ObjectVersionsLister {

let mut meta = Metadata::new(EntryMode::FILE);
meta.set_version(&delete_marker.version_id);
meta.set_is_deleted(true);
meta.set_is_current(delete_marker.is_latest);
meta.set_last_modified(parse_datetime_from_rfc3339(
delete_marker.last_modified.as_str(),
Expand Down
4 changes: 2 additions & 2 deletions core/src/types/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ impl Metadata {
}

/// Set the deleted status of this entry.
pub fn set_deleted(&mut self, v: bool) -> &mut Self {
pub fn set_is_deleted(&mut self, v: bool) -> &mut Self {
self.is_deleted = v;
self
}

/// Set the deleted status of this entry.
pub fn with_deleted(mut self, v: bool) -> Self {
pub fn with_is_deleted(mut self, v: bool) -> Self {
self.is_deleted = v;
self
}
Expand Down
2 changes: 1 addition & 1 deletion core/tests/behavior/async_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ pub async fn test_list_files_with_deleted(op: Operator) -> Result<()> {
op.delete(file_path.as_str()).await?;

// This file has been deleted
let mut ds = op.list_with(parent.as_str()).deleted(true).await?;
let mut ds = op.list_with(&file_path).deleted(true).await?;
ds.retain(|de| de.path() == file_path && de.metadata().is_deleted());

assert_eq!(
Expand Down
9 changes: 2 additions & 7 deletions core/tests/behavior/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,7 @@ impl Fixture {
pub async fn cleanup(&self, op: impl Into<Operator>) {
let op = op.into();
let paths: Vec<_> = mem::take(self.paths.lock().unwrap().as_mut());
for path in paths.iter() {
// We try our best to clean up fixtures, but won't panic if failed.
let _ = op.delete(path).await.map_err(|err| {
log::error!("fixture cleanup path {path} failed: {:?}", err);
});
log::info!("fixture cleanup path {path} succeeded")
}
// We try our best to clean up fixtures, but won't panic if failed.
let _ = op.delete_iter(paths).await;
}
}

0 comments on commit ee02fe4

Please sign in to comment.