FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

tests: new sending and filtering functions by georglauterbach · Pull Request #3786 · docker-mailserver/docker-mailserver · GitHub

tests: new sending and filtering functions - #3786

Merged
georglauterbach merged 25 commits into
masterfrom
tests/new_filters
Jan 24, 2024
Merged

tests: new sending and filtering functions#3786
georglauterbach merged 25 commits into
masterfrom
tests/new_filters

Conversation

georglauterbach commented Jan 16, 2024
edited
Loading

Copy link
Copy Markdown
Member

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_id was 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

  • Improvement (non-breaking change that does improve existing functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary, I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added information about changes made in this PR to CHANGELOG.md

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.
georglauterbach self-assigned this Jan 16, 2024
georglauterbach added area/tests kind/improvement Improve an existing feature, configuration file or the documentation labels Jan 16, 2024
georglauterbach added this to the v14.0.0 milestone Jan 16, 2024
Comment thread test/helper/common.bash

Copy link
Copy Markdown
Member

I'll review this after v13.3 is out, trying to wrap up some tasks in time for that 😅

georglauterbach mentioned this pull request Jan 19, 2024
7 tasks

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'll apply these.

Bulk of the changes are:

  • _mid / MID => _msgid / MSG_ID
  • Revised documentation / tooltip comments

Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/sending.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
- `_mid` / `MID` => `_msgid` / `MSG_ID`
- Revised documentation / tooltip comments

polarathene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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! 🥳

Comment thread test/tests/serial/vmail-id.bats Outdated
Comment thread test/tests/serial/mail_pop3.bats Outdated
Comment thread test/helper/sending.bash Outdated

polarathene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'll apply some of these, and leave some others unresolved for better visibility to you 👍

Comment thread CHANGELOG.md Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/sending.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated

polarathene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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'

polarathene Jan 21, 2024
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 😅

Comment thread test/helper/log_and_filtering.bash Outdated

polarathene commented Jan 21, 2024
edited
Loading

Copy link
Copy Markdown
Member

Huzzah! A failure like I expected 😛

not ok 86 [Rspamd] (full) RSPAMD_LEARN works in 3193ms
# (from function `assert_success' in file test/test_helper/bats-assert/src/assert_success.bash, line 42,
#  from function `_service_log_should_contain_string' in file test/helper/log_and_filtering.bash, line 50,
#  in test file test/tests/parallel/set1/spam_virus/rspamd_full.bats, line 290)
#   `_service_log_should_contain_string 'mail' 'imapsieve: Matched static mailbox rule [2]'' failed
#
# -- command failed --
# status : 1
# output :
# --
#

Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread test/helper/log_and_filtering.bash Outdated
Comment thread CHANGELOG.md
polarathene previously approved these changes Jan 24, 2024

polarathene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM 👍

May want to merge this after the base image upgrade PR?

Copy link
Copy Markdown
Member Author

Yes, this is fine with me :)

georglauterbach commented Jan 24, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

I resolved merge conflicts and enabled auto-merge. When you approve @polarathene, this will automatically be merged into master.

polarathene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🚀

georglauterbach merged commit ed1e1eb into master Jan 24, 2024
georglauterbach deleted the tests/new_filters branch January 24, 2024 22:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tests kind/improvement Improve an existing feature, configuration file or the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL