test(object-store): fix racy SecureFs abort test (#8720)

test_writer_abort_is_unsupported_without_atomic_write asserted the file
content immediately after abort() returned Unsupported. SecureFsWriter
writes through tokio::fs::File, whose write_all() only enqueues a blocking
write task (tokio's poll_write returns Ready before the write completes),
so the data may not be visible yet when the test reads the file. Drop the
race-prone content assertion and only verify the Unsupported contract.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
This commit is contained in:
Lei, HUANG
2026-08-03 10:36:56 +08:00
committed by GitHub
parent 00829903cf
commit 27462eaaf0
-7
View File
@@ -662,7 +662,6 @@ mod tests {
#[tokio::test]
async fn test_writer_abort_is_unsupported_without_atomic_write() {
let temp_dir = create_temp_dir("secure_fs_writer_abort");
std::fs::write(temp_dir.path().join("partial"), b"original").unwrap();
let operator = SecureFsRoot::open(temp_dir.path())
.unwrap()
.build_operator();
@@ -672,11 +671,5 @@ mod tests {
let error = writer.abort().await.unwrap_err();
assert_eq!(ErrorKind::Unsupported, error.kind());
assert_eq!(
b"partial",
std::fs::read(temp_dir.path().join("partial"))
.unwrap()
.as_slice()
);
}
}