mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-08-18 20:18:30 +00:00
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:
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user