Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@georglauterbach
Copy link
Member

@georglauterbach georglauterbach commented Jan 16, 2024

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 georglauterbach self-assigned this Jan 16, 2024
@georglauterbach georglauterbach added area/tests kind/improvement Improve an existing feature, configuration file or the documentation labels Jan 16, 2024
@georglauterbach georglauterbach added this to the v14.0.0 milestone Jan 16, 2024
@polarathene
Copy link
Member

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

@georglauterbach georglauterbach mentioned this pull request Jan 19, 2024
7 tasks
@georglauterbach
Copy link
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).

Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

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! πŸ₯³

Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

I'll apply some of these, and leave some others unresolved for better visibility to you πŸ‘

Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

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'
Copy link
Member

@polarathene polarathene Jan 21, 2024

Choose a reason for hiding this comment

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

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 πŸ˜…

@polarathene
Copy link
Member

polarathene commented Jan 21, 2024

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 :
# --
#

polarathene
polarathene previously approved these changes Jan 24, 2024
Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

LGTM πŸ‘

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

@georglauterbach
Copy link
Member Author

Yes, this is fine with me :)

@georglauterbach
Copy link
Member Author

georglauterbach commented Jan 24, 2024

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

Copy link
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

πŸš€

@georglauterbach georglauterbach merged commit ed1e1eb into master Jan 24, 2024
@georglauterbach georglauterbach deleted the tests/new_filters branch January 24, 2024 22:06
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.

3 participants