Skip to content

Commit

Permalink
remove write file test
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCroxx committed Apr 1, 2022
1 parent 7757d2c commit 7faed7c
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions storage/src/raftstore/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,7 @@ impl Kv {
#[cfg(test)]
mod tests {

use std::io::SeekFrom;
use std::time::SystemTime;

use tempfile::tempdir;
use test_log::test;
use tokio::fs::OpenOptions;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt};

use super::*;

Expand Down Expand Up @@ -168,28 +162,4 @@ mod tests {
}
assert_eq!(decoded_logs, logs);
}

// TODO: REMOVE ME!!
#[test(tokio::test)]
async fn test() {
let mut options = OpenOptions::new();
options.create(true);
options.read(true);
options.write(true);
#[cfg(target_os = "linux")]
{
const O_DIRECT: i32 = 0x4000;
options.custom_flags(O_DIRECT);
}
let dir = tokio::task::spawn_blocking(tempdir).await.unwrap().unwrap();
let mut f = options.open(dir.path().join("tmp")).await.unwrap();
let mut buf = vec![0u8; 4096];
let time = SystemTime::now();
f.write_all(&vec![b'x'; 4096]).await.unwrap();
f.sync_data().await.unwrap();
f.seek(SeekFrom::Start(0)).await.unwrap();
f.read_exact(&mut buf).await.unwrap();
assert_eq!(buf, vec![b'x'; 4096]);
println!("elapsed: {:?}", time.elapsed());
}
}

0 comments on commit 7faed7c

Please sign in to comment.