diff --git a/integrations/cloudfilter/tests/behavior/fetch_data.rs b/integrations/cloudfilter/tests/behavior/fetch_data.rs index 7583174d3f70..739c2736bd58 100644 --- a/integrations/cloudfilter/tests/behavior/fetch_data.rs +++ b/integrations/cloudfilter/tests/behavior/fetch_data.rs @@ -18,23 +18,32 @@ use libtest_mimic::Failed; use crate::{ - utils::{file_hash, file_length}, + utils::{file_content, file_length}, ROOT_PATH, }; pub fn test_fetch_data() -> Result<(), Failed> { - let files = ["normal_file.txt", "special_file !@#$%^&()_+-=;',.txt"]; - for file in files { + let files = [ + ( + "normal_file.txt", + include_str!("..\\..\\..\\..\\fixtures/data/normal_file.txt"), + ), + ( + "special_file !@#$%^&()_+-=;',.txt", + include_str!("..\\..\\..\\..\\fixtures/data/special_file !@#$%^&()_+-=;',.txt"), + ), + ]; + for (file, expected_content) in files { let path = format!("{ROOT_PATH}\\{file}"); assert_eq!( - 31523, + expected_content.len(), file_length(&path).expect("file length"), "file length", ); assert_eq!( - "AA3CDBDE1C58BD7727D3A4D6E4DF6A2057EBA9C928EC8EDD1DAF670E6EC67C38", - file_hash(&path).expect("file hash"), + expected_content, + file_content(&path).expect("file hash"), "file hash", ) } diff --git a/integrations/cloudfilter/tests/behavior/main.rs b/integrations/cloudfilter/tests/behavior/main.rs index 82d294626867..4a860501b750 100644 --- a/integrations/cloudfilter/tests/behavior/main.rs +++ b/integrations/cloudfilter/tests/behavior/main.rs @@ -25,8 +25,6 @@ use std::{ path::{Path, PathBuf}, pin::Pin, process::ExitCode, - thread, - time::Duration, }; use cloud_filter::{ @@ -60,7 +58,6 @@ async fn main() -> ExitCode { } let (sync_root_id, connection) = init(op); - thread::sleep(Duration::from_secs(10)); let tests = vec![ Trial::test("fetch_data", fetch_data::test_fetch_data), diff --git a/integrations/cloudfilter/tests/behavior/utils.rs b/integrations/cloudfilter/tests/behavior/utils.rs index 709ce5028f91..105cc4064d87 100644 --- a/integrations/cloudfilter/tests/behavior/utils.rs +++ b/integrations/cloudfilter/tests/behavior/utils.rs @@ -31,15 +31,12 @@ pub fn file_length(path: impl Display) -> anyhow::Result { Ok(len) } -pub fn file_hash(path: impl Display) -> anyhow::Result { - let hash = powershell_script::run(&format!("(Get-FileHash \"{path}\" -Algorithm SHA256).Hash")) +pub fn file_content(path: impl Display) -> anyhow::Result { + let content = powershell_script::run(&format!("Get-Content \"{path}\"")) .context("run powershell")? .stdout() - .unwrap_or_default() - .trim() - .into(); - - Ok(hash) + .unwrap_or_default(); + Ok(content) } pub fn list(path: impl Display, option: impl Display) -> anyhow::Result> {