Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Passaro <[email protected]>
  • Loading branch information
passaro committed Jun 30, 2023
1 parent 9abec1c commit 5281dc0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mountpoint-s3/tests/fuse_tests/write_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::fs::{metadata, read, read_dir, File};
use std::io::{ErrorKind, Read, Write, Seek};
use std::io::{ErrorKind, Read, Seek, Write};
use std::os::unix::prelude::OpenOptionsExt;
use std::path::Path;
use std::time::Duration;
Expand Down Expand Up @@ -301,24 +301,24 @@ where
let mut body = vec![0u8; OBJECT_SIZE];
rng.fill(&mut body[..]);

let part1 = &body[..(OBJECT_SIZE/2)];
let part2 = &body[(OBJECT_SIZE/2)..];
let part1 = &body[..(OBJECT_SIZE / 2)];
let part2 = &body[(OBJECT_SIZE / 2)..];

f.write_all(&part1).unwrap();
f.write_all(part1).unwrap();

// Attempt to seek to start and write over.
f.seek(std::io::SeekFrom::Start(0)).unwrap();
let err = f.write_all(&part2).expect_err("out of order write should fail");
let err = f.write_all(part2).expect_err("out of order write should fail");
assert_eq!(err.raw_os_error(), Some(libc::EINVAL));

// Attempt to seek beyond end and write.
f.seek(std::io::SeekFrom::Start((part1.len() + 1) as u64)).unwrap();
let err = f.write_all(&part2).expect_err("out of order write should fail");
let err = f.write_all(part2).expect_err("out of order write should fail");
assert_eq!(err.raw_os_error(), Some(libc::EINVAL));

// Seek where we left off and write sequentially.
f.seek(std::io::SeekFrom::Start((part1.len()) as u64)).unwrap();
f.write_all(&part2).unwrap();
f.write_all(part2).unwrap();

drop(f);

Expand Down

0 comments on commit 5281dc0

Please sign in to comment.