mirror of
https://git.proxmox.com/git/pmg-log-tracker
synced 2025-04-28 16:51:47 +00:00
change tests to use faketime
We only have the month, day, hours, minutes and seconds available to us, but not the year. Because of this we assume the logs are always relative to the current year. This means when running the log tracker the CTIME is calculated based on the current year and once a new year starts, all old tests have to be updated to match the new year. To work around this issue, use 'faketime' to set the time to 2020-12-31 23:59:59 as all tests assume 2020 as the year. Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
77b430e04a
commit
ef4e4370a3
3
debian/control
vendored
3
debian/control
vendored
@ -10,7 +10,8 @@ Build-Depends: debhelper (>= 11),
|
||||
librust-failure-0.1+default-dev (>= 0.1.5-~~),
|
||||
librust-flate2-1+default-dev (>= 1.0.6-~~),
|
||||
librust-libc-0.2+default-dev (>= 0.2.48-~~),
|
||||
librust-time-0.1+default-dev (>= 0.1.42-~~)
|
||||
librust-time-0.1+default-dev (>= 0.1.42-~~),
|
||||
faketime
|
||||
Maintainer: Proxmox Support Team <support@proxmox.com>
|
||||
Standards-Version: 4.4.1
|
||||
Vcs-Git: git://git.proxmox.com/git/pmg-log-tracker.git
|
||||
|
1
debian/debcargo.toml
vendored
1
debian/debcargo.toml
vendored
@ -7,6 +7,7 @@ section = "admin"
|
||||
homepage = "http://www.proxmox.com"
|
||||
vcs_git = "git://git.proxmox.com/git/pmg-log-tracker.git"
|
||||
vcs_browser = "https://git.proxmox.com/?p=pmg-log-tracker.git;a=summary"
|
||||
build_depends = ["faketime"]
|
||||
|
||||
[package]
|
||||
summary = "Proxmox Mailgateway Log Tracker"
|
||||
|
@ -6,7 +6,9 @@ mod utils;
|
||||
|
||||
#[test]
|
||||
fn after_queue_start_end_time_string() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("2020-12-18 15:40:00")
|
||||
@ -27,7 +29,9 @@ fn after_queue_start_end_time_string() {
|
||||
|
||||
#[test]
|
||||
fn after_queue_start_end_timestamp() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608302400")
|
||||
@ -48,7 +52,9 @@ fn after_queue_start_end_timestamp() {
|
||||
|
||||
#[test]
|
||||
fn after_queue_qid() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608302400")
|
||||
@ -71,7 +77,9 @@ fn after_queue_qid() {
|
||||
|
||||
#[test]
|
||||
fn after_queue_host() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608302400")
|
||||
@ -94,7 +102,9 @@ fn after_queue_host() {
|
||||
|
||||
#[test]
|
||||
fn after_queue_search_string() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608302400")
|
||||
@ -117,7 +127,9 @@ fn after_queue_search_string() {
|
||||
|
||||
#[test]
|
||||
fn after_queue_search_string_case_insensitive() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608302400")
|
||||
|
@ -5,7 +5,9 @@ mod utils;
|
||||
|
||||
#[test]
|
||||
fn before_queue_start_end_time_string() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("2020-12-18 15:00:00")
|
||||
@ -26,7 +28,9 @@ fn before_queue_start_end_time_string() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_start_end_timestamp() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -47,7 +51,9 @@ fn before_queue_start_end_timestamp() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_qid() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -70,7 +76,9 @@ fn before_queue_qid() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_host() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -93,7 +101,9 @@ fn before_queue_host() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_search_string() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -116,7 +126,9 @@ fn before_queue_search_string() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_search_string_case_insensitive() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -139,7 +151,9 @@ fn before_queue_search_string_case_insensitive() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_exclude_greylist_ndr() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -162,7 +176,9 @@ fn before_queue_exclude_greylist_ndr() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_to() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -185,7 +201,9 @@ fn before_queue_to() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_mixed_downstream() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-v")
|
||||
.arg("-s")
|
||||
.arg("1608303600")
|
||||
@ -206,7 +224,9 @@ fn before_queue_mixed_downstream() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_from_to() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1608300000")
|
||||
@ -231,7 +251,9 @@ fn before_queue_from_to() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_mixed_accept_block_quarantine() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1588254000")
|
||||
@ -253,7 +275,9 @@ fn before_queue_mixed_accept_block_quarantine() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_to_search_string() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("1589810100")
|
||||
@ -278,7 +302,9 @@ fn before_queue_to_search_string() {
|
||||
|
||||
#[test]
|
||||
fn before_queue_syntax_reject() {
|
||||
let output = Command::new(utils::log_tracker_path())
|
||||
let output = Command::new("faketime")
|
||||
.arg("2020-12-31 23:59:59")
|
||||
.arg(utils::log_tracker_path())
|
||||
.arg("-vv")
|
||||
.arg("-s")
|
||||
.arg("2020-08-27 14:00:00")
|
||||
|
Loading…
Reference in New Issue
Block a user