From 9088bd18dd171bf1aaf6e533af4b2590e0f1abd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Sun, 8 Sep 2024 15:02:51 +0200 Subject: [PATCH 1/2] Fix test failure in ipr request size that suddenly appeared --- common/ip-packet-requests/src/v7/request.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/ip-packet-requests/src/v7/request.rs b/common/ip-packet-requests/src/v7/request.rs index 24f9819c2a2..d8a0a34efcf 100644 --- a/common/ip-packet-requests/src/v7/request.rs +++ b/common/ip-packet-requests/src/v7/request.rs @@ -438,7 +438,7 @@ mod tests { } ), }; - assert_eq!(connect.to_bytes().unwrap().len(), 139); + assert_eq!(connect.to_bytes().unwrap().len(), 141); } #[test] From f8ba98f1485c41cc2c9768ea202cf50bdaa275fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 9 Sep 2024 11:06:01 +0200 Subject: [PATCH 2/2] Use fixed date in unit test --- common/ip-packet-requests/src/v7/request.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/ip-packet-requests/src/v7/request.rs b/common/ip-packet-requests/src/v7/request.rs index d8a0a34efcf..73266320e39 100644 --- a/common/ip-packet-requests/src/v7/request.rs +++ b/common/ip-packet-requests/src/v7/request.rs @@ -415,6 +415,8 @@ pub struct HealthRequest { #[cfg(test)] mod tests { + use time::macros::datetime; + use super::*; use std::net::{Ipv4Addr, Ipv6Addr}; use std::str::FromStr; @@ -432,13 +434,13 @@ mod tests { reply_to_hops: None, reply_to_avg_mix_delays: None, buffer_timeout: None, - timestamp: OffsetDateTime::now_utc(), + timestamp: datetime!(2024-01-01 12:59:59.5 UTC), }, signature: None, } ), }; - assert_eq!(connect.to_bytes().unwrap().len(), 141); + assert_eq!(connect.to_bytes().unwrap().len(), 139); } #[test]