From acd87a23fa0d369ca2f355376971e26e89abc16f Mon Sep 17 00:00:00 2001 From: Sehyo Date: Tue, 5 Oct 2021 17:49:52 +0000 Subject: [PATCH] update test --- crates/fluvio-storage/src/validator.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/fluvio-storage/src/validator.rs b/crates/fluvio-storage/src/validator.rs index c36ae177c90..dbe97dde6ea 100644 --- a/crates/fluvio-storage/src/validator.rs +++ b/crates/fluvio-storage/src/validator.rs @@ -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; @@ -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; @@ -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"), + }; } }