]> git.proxmox.com Git - pmg-log-tracker.git/commitdiff
tests: explicitly set timezone for testcases with unix timestamps
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 19 Jun 2023 18:40:48 +0000 (20:40 +0200)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 26 Jun 2023 11:01:27 +0000 (13:01 +0200)
noticed when building with sbuild, which uses UTC as timezone:
Due to the parsing of traditional syslog time information (which does
not contain timezone information) the testcases passing
unix-timestamps as arguments failed.

Explicitly setting TZ to Europe/Vienna fixes the tests (and makes the
assumption visible)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
tests/tests_after_queue.rs
tests/tests_before_queue.rs

index 104ccc67e9a62f578d6e21c4cb19d0cfcbc3ed92..8e135646146ceb6becb450eabdbd06e235c94825 100644 (file)
@@ -30,6 +30,7 @@ fn after_queue_start_end_time_string() {
 #[test]
 fn after_queue_start_end_timestamp() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -53,6 +54,7 @@ fn after_queue_start_end_timestamp() {
 #[test]
 fn after_queue_qid() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -78,6 +80,7 @@ fn after_queue_qid() {
 #[test]
 fn after_queue_host() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -103,6 +106,7 @@ fn after_queue_host() {
 #[test]
 fn after_queue_search_string() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -128,6 +132,7 @@ fn after_queue_search_string() {
 #[test]
 fn after_queue_search_string_case_insensitive() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -153,6 +158,7 @@ fn after_queue_search_string_case_insensitive() {
 #[test]
 fn after_queue_relay_before_lmtp() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -176,6 +182,7 @@ fn after_queue_relay_before_lmtp() {
 #[test]
 fn after_queue_duplicate_msgid() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
index 6089b92b2660aed0d3416c590d6822f841edcb86..0c9c2f242bfbc41cb25a75078681592a8f7cbe6b 100644 (file)
@@ -29,6 +29,7 @@ fn before_queue_start_end_time_string() {
 #[test]
 fn before_queue_start_end_timestamp() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -52,6 +53,7 @@ fn before_queue_start_end_timestamp() {
 #[test]
 fn before_queue_qid() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -77,6 +79,7 @@ fn before_queue_qid() {
 #[test]
 fn before_queue_host() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -102,6 +105,7 @@ fn before_queue_host() {
 #[test]
 fn before_queue_search_string() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -127,6 +131,7 @@ fn before_queue_search_string() {
 #[test]
 fn before_queue_search_string_case_insensitive() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -152,6 +157,7 @@ fn before_queue_search_string_case_insensitive() {
 #[test]
 fn before_queue_exclude_greylist_ndr() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -177,6 +183,7 @@ fn before_queue_exclude_greylist_ndr() {
 #[test]
 fn before_queue_to() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -202,6 +209,7 @@ fn before_queue_to() {
 #[test]
 fn before_queue_mixed_downstream() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-v")
@@ -225,6 +233,7 @@ fn before_queue_mixed_downstream() {
 #[test]
 fn before_queue_from_to() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -252,6 +261,7 @@ fn before_queue_from_to() {
 #[test]
 fn before_queue_mixed_accept_block_quarantine() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")
@@ -276,6 +286,7 @@ fn before_queue_mixed_accept_block_quarantine() {
 #[test]
 fn before_queue_to_search_string() {
     let output = Command::new("faketime")
+        .env("TZ", "Europe/Vienna")
         .arg("2020-12-31 23:59:59")
         .arg(utils::log_tracker_path())
         .arg("-vv")