tests: new sending and filtering functions#3786
Conversation
The new function, called `_send_email_with_mid`, aligns with suggestions from @polarethene and is heavily simplified compared to its predecessor `_send_email_and_get_id`. New helpers will be introduced to filter logs according to the MID constructed in this function.
065298e to
6503f24
Compare
|
I'll review this after v13.3 is out, trying to wrap up some tasks in time for that 😅 |
Nice! This is basically just me implementing what you proposed in #3747 (comment). |
polarathene
left a comment
There was a problem hiding this comment.
I'll apply these.
Bulk of the changes are:
_mid/MID=>_msgid/MSG_ID- Revised documentation / tooltip comments
- `_mid` / `MID` => `_msgid` / `MSG_ID` - Revised documentation / tooltip comments
polarathene
left a comment
There was a problem hiding this comment.
I'd personally prefer being more explicit about those that are using regex, potentially with a _regex variant of such methods 🤷♂️
Probably unlikely to be an issue but technically all those logs being checked for addresses will treat the . as any character rather than an actual .? Fixed string matching by default seems better suited?
Feel free to delay that to a separate PR.
Great work! 🥳
Moreover, I added a function to print the whole mail log. Appropriate comments were added to this function to indicate that one should only use this function when necessary.
polarathene
left a comment
There was a problem hiding this comment.
I'll apply some of these, and leave some others unresolved for better visibility to you 👍
polarathene
left a comment
There was a problem hiding this comment.
Just the prior review feedback and some additional feedback here to address and this looks good to go! 😁 🚀
| _service_log_should_contain_string 'rspamd' 'reject "ClamAV FOUND VIRUS "Eicar-Signature"' | ||
|
|
||
| _print_mail_log_for_id "${MAIL_ID_VIRUS}" | ||
| _print_mail_log_of_queue_id_from_msgid 'rspamd-test-email-virus' |
There was a problem hiding this comment.
Similar to the dms-test-email-spam, it might be nice to have the equivalent for virus. Not required to be addressed in this PR though since there's plenty of noise here already 😅
|
Huzzah! A failure like I expected 😛 |
polarathene
left a comment
There was a problem hiding this comment.
LGTM 👍
May want to merge this after the base image upgrade PR?
|
Yes, this is fine with me :) |
|
I resolved merge conflicts and enabled auto-merge. When you approve @polarathene, this will automatically be merged into |
Description
This PR is intended to solve concerns raised in #3747 (comment) by @polarathene.
A new file for log filter helpers was created. Thereafter,
_send_email_and_get_idwas reworked to become_send_email_with_mid. I paid attention to using sub-shells only where necessary. This new way of sending + filtering allows for greater flexibility and the implementation has become easier. Last but not least, I updated the service log filters and applied them throughout all our tests to improve code quality.Review commit by commit.
Type of change
Checklist:
docs/)CHANGELOG.md