chore: форматирование тестов wg и reboot module

This commit is contained in:
2026-05-11 18:16:26 +05:00
parent 381c106f9d
commit 3d5bec424c
2 changed files with 16 additions and 11 deletions
+12 -7
View File
@@ -209,8 +209,8 @@ mod tests {
#[test]
fn window_inside_day_now_inside_window_uses_now_to_end() {
let now = NaiveDateTime::parse_from_str("2026-01-10 01:30:00", "%Y-%m-%d %H:%M:%S")
.expect("now");
let now =
NaiveDateTime::parse_from_str("2026-01-10 01:30:00", "%Y-%m-%d %H:%M:%S").expect("now");
let (s, e) = current_or_next_window(
now,
parse_hhmm("01:30").expect("time"),
@@ -219,13 +219,16 @@ mod tests {
)
.expect("window");
assert_eq!(s, now);
assert_eq!(e.format("%Y-%m-%d %H:%M:%S").to_string(), "2026-01-10 02:00:00");
assert_eq!(
e.format("%Y-%m-%d %H:%M:%S").to_string(),
"2026-01-10 02:00:00"
);
}
#[test]
fn cross_midnight_window_supported() {
let now = NaiveDateTime::parse_from_str("2026-01-10 23:30:00", "%Y-%m-%d %H:%M:%S")
.expect("now");
let now =
NaiveDateTime::parse_from_str("2026-01-10 23:30:00", "%Y-%m-%d %H:%M:%S").expect("now");
let (s, e) = current_or_next_window(
now,
parse_hhmm("23:30").expect("time"),
@@ -234,7 +237,10 @@ mod tests {
)
.expect("window");
assert_eq!(s, now);
assert_eq!(e.format("%Y-%m-%d %H:%M:%S").to_string(), "2026-01-11 02:00:00");
assert_eq!(
e.format("%Y-%m-%d %H:%M:%S").to_string(),
"2026-01-11 02:00:00"
);
}
#[test]
@@ -243,4 +249,3 @@ mod tests {
assert!(err.is_some());
}
}
+4 -4
View File
@@ -261,10 +261,10 @@ mod tests {
#[test]
fn primary_failure_falls_back_to_wg_show() {
let transport = TestTransport::new(vec![(
"wg show all allowed-ips",
Err(anyhow::anyhow!("wg broken")),
), ("wg show", Ok("allowed ips: 10.8.1.4/32"))]);
let transport = TestTransport::new(vec![
("wg show all allowed-ips", Err(anyhow::anyhow!("wg broken"))),
("wg show", Ok("allowed ips: 10.8.1.4/32")),
]);
let peers = discover_peers_with_transport(&transport, "10.8.1.0/24").expect("peers");
assert_eq!(peers.len(), 1);