Commit Graph

26 Commits

Author SHA1 Message Date
Mira Limbeck
033d9fea42 tests: update for log tracker time handling changes
since we now calculate the time in UTC rather than local time, the time
values of each test had to be touched. those should differ by `E10`
(3600 seconds) in most cases since we set the TZ to Europe/Vienna for
the tests.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2024-02-23 18:29:17 +01:00
Mira Limbeck
a36803db4a tests: improve test output consistency
`expected` and `command` are more helpful than `new` and `old`.
the order of `expected` and `command` should now always be the same:
expected before command

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2024-02-23 18:29:17 +01:00
Mira Limbeck
4d645342e1 tests: update to match the compatibility changes
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2023-06-28 11:50:44 +02:00
Mira Limbeck
bc64fc8041 tests: add rfc3339 timestamp test
for this test `faketime` is not required since the year is part of the
timestamp

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-26 18:04:53 +02:00
Stoiko Ivanov
b154004956 tests: explicitly set timezone for testcases with unix timestamps
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>
2023-06-26 13:01:27 +02:00
Thomas Lamprecht
ddaa372402 tree wide cargo fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-07-13 11:30:26 +02:00
Stoiko Ivanov
a4d769405c add tests for DST change and year change
based on our outbound production logs but anonymized

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2022-02-14 14:43:55 +01:00
Stoiko Ivanov
b87d0b0583 add test for empty to (dnsbl reject)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-12-01 19:02:30 +01:00
Mira Limbeck
2912583794 fix mutable borrow panic on duplicate msgid
Because of the relay before lmtp issue we now add and remove QEntrys
based on their message-id. But if the cleanup line containing the
message-id appears twice in the log for the same QEntry it keeps a weak
reference to itself which leads to a panic because of a mutable borrow
while it is already mutably borrowed in the 'finalize' function.

To circumvent this we check after the lookup if it is the same QEntry
and if so, insert it again with that message-id in the lookup table and
don't add the weak reference.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
2021-05-11 15:48:57 +02:00
Mira Limbeck
f6cbaf2f48 add test case for relay removed before lmtp
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2021-03-23 15:40:19 +01:00
Mira Limbeck
48485c2bb2 close #2106: show outgoing TLS connection in tracking center
This is a best effort try to add the outgoing TLS connection information
to the output of pmg-log-tracker. The only thing we can match on is the
PID of the 'smtp' process. In the code we asumme that the TLS log entry
always happens before the actual smtp send entry that has a QID. This means
we save the TLS log entry in a map with the PID as key and then, once the
send entry happens, we look it up and add the log entry to the QEntry's
logs.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2021-03-23 14:05:18 +01:00
Mira Limbeck
ef4e4370a3 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>
2021-03-22 16:20:32 +01:00
Fabian Grünbichler
77b430e04a debcargo: fix maintainer directive
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-02-01 11:29:02 +01:00
Mira Limbeck
c409629f80 change case sensitive string match to case insensitive
With the rewrite from C to Rust the search string match was changed to
be case sensitive by accident. Fix this by comparing the lowercase values
of both the input and the search string.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-11-17 08:18:21 +01:00
Mira Limbeck
dbab0bf5db add output for proxy-reject with 'Syntax:' message
Messages like the following
'proxy-reject: END-OF-MESSAGE: 501 5.5.2 Syntax: MAIL FROM: <address>;'
can happen if an EHLO keyword is announced which is not handled by
pmg-smtp-filter (see #2795). This patch adds output to the log tracker
so this mail shows up as 'rejected' in the GUI instead of silently
ignoring it.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-09-03 17:15:23 +02:00
Mira Limbeck
ff635f99db add testcase for mixed '-t' and '-x' options in before-queue filtering
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-05-19 16:33:53 +02:00
Mira Limbeck
5cce7a774a add testcase for accepted/blocked/quarantined mail
The testcase contains a mail that is accepted for one address, blocked
for another and quarantined for a third address.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-05-18 14:24:54 +02:00
Mira Limbeck
54a122d957 add test case for 'from' and 'to' together
Updates the other test outputs' line numbers so the tests don't fail
because of an addition in between.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-05-06 13:20:58 +02:00
Stoiko Ivanov
d1dde9d3e1 add test for before queue dstatus
Reviewed-By: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-05-06 13:12:13 +02:00
Stoiko Ivanov
397577454a Introduce before queue dstatus
Currently the status of a before queue filtered mail is the status of the
downstream delivery in case the downstream rejects or defers a mail.

This information is too little to distinguish between a mail which went
through the rule-system, and a locally generated one
(e.g. bounce or spamreport).

By introducing 3 new distinct dstatus values we can use the information to
correctly display the status of a mail in the GUI.

Reviewed-By: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2020-05-06 13:12:13 +02:00
Dominik Csapak
4d1bf8f928 before-queue: set 'B' status for rule-system blocked mails
we want to show mails that were blocked by the rule-system as 'Blocked'
in the ui, so we have to use the dstatus of the to entry, and not
'NOQUEUE'

mails rejected by postscreen, etc. still show 'rejected'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-24 11:57:13 +02:00
Mira Limbeck
093033c8cd add a test case for recipient filtering
Add a before queue test case to test recipient filtering. Previously
all SEntry filter entries were printed because filtering failed. Now
test that it only prints the specified ones.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-04-06 11:57:25 +02:00
Mira Limbeck
20141d5863 fix wrong order of arguments
This fixes the output in the case of a failed assert. Exptected and
Command were swapped.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-04-06 11:57:22 +02:00
Mira Limbeck
85fdd484ed add test for the exclude_greylist fix
This tests the before queue case with both '-g' and 'n' options set.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2020-03-24 11:40:19 +01:00
Fabian Grünbichler
abd7fe2d82 packaging cleanup
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-28 11:58:09 +01:00
Mira Limbeck
aee1def7c3 add tests
Add tests for some command line options. Not all have a test yet, but at
least most of the ones used by the GUI (-s, -e, -q, -x). '-g' and '-n' are
currently still missing.

The tests will only be valid until end of January 31st 2021 because of
missing year info in the syslog.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-21 09:47:37 +01:00