diff options
author | Vincent Ambo <mail@tazj.in> | 2022-02-18T09·49+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-02-18T11·52+0000 |
commit | 71d6a02ca19857a06bc789f09c885e5cd77f7212 (patch) | |
tree | a64cf3e1e38da78b8c6ce0dda2483958545af016 /ops/journaldriver/src/tests.rs | |
parent | af512558e695605fdfc1b3ede407a6067e355e30 (diff) |
refactor(journaldriver): Use time crate directly instead of chrono r/3856
With this change, we still depend on chrono (through medallion), but but I'm going to try and fix that upstream as well. Change-Id: Iefd3d8578ea8870961107f3222dea7f936c2dd9a Reviewed-on: https://cl.tvl.fyi/c/depot/+/5311 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'ops/journaldriver/src/tests.rs')
-rw-r--r-- | ops/journaldriver/src/tests.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ops/journaldriver/src/tests.rs b/ops/journaldriver/src/tests.rs index 391d39947101..6f5045d6a5cd 100644 --- a/ops/journaldriver/src/tests.rs +++ b/ops/journaldriver/src/tests.rs @@ -1,5 +1,6 @@ use super::*; use serde_json::to_string; +use time::macros::datetime; #[test] fn test_text_entry_serialization() { @@ -23,10 +24,9 @@ fn test_text_entry_serialization() { #[test] fn test_timestamped_entry_serialization() { - let timestamp: DateTime<Utc> = "1952-10-07T12:00:00Z".to_string().parse().unwrap(); let entry = LogEntry { labels: Value::Null, - timestamp: Some(timestamp), + timestamp: Some(datetime!(1952-10-07 12:00:00 UTC)), payload: Payload::TextPayload { text_payload: "test entry".into(), }, @@ -125,7 +125,7 @@ fn test_json_no_object() { #[test] fn test_parse_microseconds() { let input: String = "1529175149291187".into(); - let expected: DateTime<Utc> = "2018-06-16T18:52:29.291187Z".to_string().parse().unwrap(); + let expected: time::OffsetDateTime = datetime!(2018-06-16 18:52:29.291187 UTC); assert_eq!(Some(expected), parse_microseconds(input)); } |