Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
sehz committed Oct 5, 2021
1 parent 4f81fca commit 076b99b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/fluvio-storage/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ where
mod tests {

use std::env::temp_dir;
use std::io::ErrorKind;

use flv_util::fixture::ensure_new_dir;
use futures_lite::io::AsyncWriteExt;
Expand All @@ -115,6 +116,7 @@ mod tests {
use crate::mut_records::MutFileRecords;
use crate::config::ConfigOption;
use crate::records::FileRecords;
use crate::validator::LogValidationError;

use super::validate;

Expand Down Expand Up @@ -212,7 +214,15 @@ mod tests {
let bytes = vec![0x01, 0x02, 0x03];
f_sink.write_all(&bytes).await.expect("write some junk");
f_sink.flush().await.expect("flush");
assert!(validate(&test_file).await.is_err());
match validate(&test_file).await {
Err(err) => match err {
LogValidationError::Io(io_err) => {
assert!(matches!(io_err.kind(), ErrorKind::UnexpectedEof));
}
_ => panic!("unexpected error"),
},
Ok(_) => panic!("should have failed"),
};
}
}

Expand Down

0 comments on commit 076b99b

Please sign in to comment.