diff --git a/src/agent/rustjail/src/mount.rs b/src/agent/rustjail/src/mount.rs index 76bd57a3af..ca98e7479d 100644 --- a/src/agent/rustjail/src/mount.rs +++ b/src/agent/rustjail/src/mount.rs @@ -1365,7 +1365,7 @@ mod tests { let msg = format!("{}, result: {:?}", msg, result); // Perform the checks - assert!(result == t.result, msg); + assert!(result == t.result, "{}", msg); } } } diff --git a/src/agent/src/config.rs b/src/agent/src/config.rs index 8225eee5fc..3d6e168e62 100644 --- a/src/agent/src/config.rs +++ b/src/agent/src/config.rs @@ -334,7 +334,7 @@ mod tests { if $expected_result.is_ok() { let expected_level = $expected_result.as_ref().unwrap(); let actual_level = $actual_result.unwrap(); - assert!(*expected_level == actual_level, $msg); + assert!(*expected_level == actual_level, "{}", $msg); } else { let expected_error = $expected_result.as_ref().unwrap_err(); let expected_error_msg = format!("{:?}", expected_error); @@ -342,9 +342,9 @@ mod tests { if let Err(actual_error) = $actual_result { let actual_error_msg = format!("{:?}", actual_error); - assert!(expected_error_msg == actual_error_msg, $msg); + assert!(expected_error_msg == actual_error_msg, "{}", $msg); } else { - assert!(expected_error_msg == "expected error, got OK", $msg); + assert!(expected_error_msg == "expected error, got OK", "{}", $msg); } } }; diff --git a/src/agent/src/mount.rs b/src/agent/src/mount.rs index 8cbbb0e065..af32a88b8d 100644 --- a/src/agent/src/mount.rs +++ b/src/agent/src/mount.rs @@ -900,7 +900,7 @@ mod tests { let msg = format!("{}: result: {:?}", msg, result); if d.error_contains.is_empty() { - assert!(result.is_ok(), msg); + assert!(result.is_ok(), "{}", msg); // Cleanup unsafe { @@ -912,7 +912,7 @@ mod tests { let msg = format!("{}: umount result: {:?}", msg, result); - assert!(ret == 0, msg); + assert!(ret == 0, "{}", msg); }; continue; @@ -920,7 +920,7 @@ mod tests { let err = result.unwrap_err(); let error_msg = format!("{}", err); - assert!(error_msg.contains(d.error_contains), msg); + assert!(error_msg.contains(d.error_contains), "{}", msg); } } @@ -1026,13 +1026,13 @@ mod tests { let msg = format!("{}: result: {:?}", msg, result); if d.error_contains.is_empty() { - assert!(result.is_ok(), msg); + assert!(result.is_ok(), "{}", msg); continue; } let error_msg = format!("{:#}", result.unwrap_err()); - assert!(error_msg.contains(d.error_contains), msg); + assert!(error_msg.contains(d.error_contains), "{}", msg); } } @@ -1108,6 +1108,7 @@ mod tests { assert!( format!("{}", err).contains("No such file or directory"), + "{}", msg ); } @@ -1136,13 +1137,13 @@ mod tests { if d.error_contains.is_empty() { let fs_type = result.unwrap(); - assert!(d.fs_type == fs_type, msg); + assert!(d.fs_type == fs_type, "{}", msg); continue; } let error_msg = format!("{}", result.unwrap_err()); - assert!(error_msg.contains(d.error_contains), msg); + assert!(error_msg.contains(d.error_contains), "{}", msg); } } @@ -1291,34 +1292,34 @@ mod tests { let msg = format!("{}: result: {:?}", msg, result); if !d.error_contains.is_empty() { - assert!(result.is_err(), msg); + assert!(result.is_err(), "{}", msg); let error_msg = format!("{}", result.unwrap_err()); - assert!(error_msg.contains(d.error_contains), msg); + assert!(error_msg.contains(d.error_contains), "{}", msg); continue; } - assert!(result.is_ok(), msg); + assert!(result.is_ok(), "{}", msg); let mounts = result.unwrap(); let count = mounts.len(); if !d.devices_cgroup { - assert!(count == 0, msg); + assert!(count == 0, "{}", msg); continue; } // get_cgroup_mounts() adds the device cgroup plus two other mounts. - assert!(count == (1 + 2), msg); + assert!(count == (1 + 2), "{}", msg); // First mount - assert!(mounts[0].eq(&first_mount), msg); + assert!(mounts[0].eq(&first_mount), "{}", msg); // Last mount - assert!(mounts[2].eq(&last_mount), msg); + assert!(mounts[2].eq(&last_mount), "{}", msg); // Devices cgroup - assert!(mounts[1].eq(&cg_devices_mount), msg); + assert!(mounts[1].eq(&cg_devices_mount), "{}", msg); } } } diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index 5062486e9c..bee68aae20 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -2018,9 +2018,9 @@ mod tests { let msg = format!("{}, result: {:?}", msg, result); if result.is_ok() { - assert!(!d.expect_error, msg); + assert!(!d.expect_error, "{}", msg); } else { - assert!(d.expect_error, msg); + assert!(d.expect_error, "{}", msg); } } }