From 36636dcc932faee90389592801c1728aad867c7e Mon Sep 17 00:00:00 2001 From: yoloyyh Date: Fri, 22 Nov 2024 20:15:50 +0800 Subject: [PATCH] fix unit test --- plugins/lib/rust/src/lib.rs | 2 +- rasp/librasp/src/manager.rs | 4 +++- rasp/librasp/src/php.rs | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/lib/rust/src/lib.rs b/plugins/lib/rust/src/lib.rs index e816056ef..ab33d59e9 100644 --- a/plugins/lib/rust/src/lib.rs +++ b/plugins/lib/rust/src/lib.rs @@ -217,7 +217,7 @@ impl Client { w.write_all(rec.timestamp.to_string().as_bytes())?; w.write_all(b",\"data\":")?; serde_json::to_writer(w.by_ref(), rec.get_data().get_fields())?; - w.write_all(b"}\n") + w.write_all(b"}\n")? } Ok(()) } diff --git a/rasp/librasp/src/manager.rs b/rasp/librasp/src/manager.rs index 9a72c79f1..3c538cdbf 100644 --- a/rasp/librasp/src/manager.rs +++ b/rasp/librasp/src/manager.rs @@ -997,11 +997,12 @@ mod tests { fake_configs.push(PidMissingProbeConfig { message_type: 9, data: ProbeConfigData { - uuid: "fake".to_string(), + uuid: Some("fake".to_string()), blocks: None, filters: None, limits: None, patches: Some(fake_patches), + ..Default::default() }, }); let fake_manager = RASPManager { @@ -1009,6 +1010,7 @@ mod tests { thread_comm: None, process_comm: None, runtime_dir: false, + ebpf_comm: None, }; println!("{:?}", fake_configs); let _ = fake_manager diff --git a/rasp/librasp/src/php.rs b/rasp/librasp/src/php.rs index 674138d87..1ec5d2302 100644 --- a/rasp/librasp/src/php.rs +++ b/rasp/librasp/src/php.rs @@ -371,6 +371,9 @@ mod php_test { Ok(ProbeState::NotAttach) => { println!("probe NotATTACH"); } + Ok(ProbeState::AttachedVersionNotMatch) => { + println!("probe AttachedVersionNotMatch"); + } Err(e) => { println!("{} check probe state failed: {}", process_info.pid, e); }