tests(refactor): mail_lmtp_ip.bats#3004
Merged
polarathene merged 6 commits intodocker-mailserver:masterfrom Jan 15, 2023
Merged
tests(refactor): mail_lmtp_ip.bats#3004polarathene merged 6 commits intodocker-mailserver:masterfrom
mail_lmtp_ip.bats#3004polarathene merged 6 commits intodocker-mailserver:masterfrom
Conversation
None of this is needed. Only relevant change is changing the LMTP service listener for Dovecot and that can be delegated to `user-patches.sh`.
Only relevant changes in test config regarding LMTP: - `/etc/dovecot/dovecot.conf` (`protocols = imap lmtp`) and `/etc/dovecot/protocols.d/` (`protocols = $protocols lmtp`). - `conf.d/10-master.conf` only changed the LMTP service listener from a unix socket to TCP on port 24 (_This was the only change required for the test to pass_). None of those configs are required as: - `protocols = imap pop3 lmtp` [is the upstream default](https://doc.dovecot.org/settings/core/#core_setting-protocols), no need to add `lmtp`. - The LMTP service listener is now configured for the test with `user-patches.sh`.
- Converted to new testing conventions and common container helpers. - `ENABLE_POSTFIX_VIRTUAL_TRANSPORT` was not relevant, dropped. - Revised test cases, logic remains the same. - Large custom config used was not documented and doesn't appear to serve any purpose. Simplified by replacing with a single modification with `user-patches.sh`. - Added some additional comments for context of test and improvements that could be made.
The comment from `mail_hostname` provides no valid context, it was likely copied over from `tests.bats` in Oct 2020 by accident. The email sent is just for testing, nothing relevant to LMTP. --- Added additional comment for test to reference extra information from.
Extracts out the match pattern and formatting commands into separate vars (reduces horizontal scrolling), and includes extra docs about what the matched line should be expected to look like.
Contributor
|
Documentation preview for this PR is ready! 🎉 Built with commit: b02f759 |
6 tasks
casperklein
approved these changes
Jan 14, 2023
12 tasks
1 task
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This refactoring required a bit of extra investigation into the feature under test. That revealed some redundant content to drop, detailed below.
Refactor summary
ENABLE_POSTFIX_VIRTUAL_TRANSPORTwas not relevant, dropped. OnlyPOSTFIX_DAGENTmatters for the feature.user-patches.sh.NOTE: The ENV removal here is not a breaking change. So long as the actual ENV with LMTP URI is present, it continues to work (unless someone weirdly relied on keeping that URI var and toggling the enable var instead). It is part of v12 and changelog will still highlight it regardless if some third-party integrations were relying upon it.
The feature itself seems rather niche. You'd still need to manually configure DMS like the
user-patches.shis doing to leverage it with another DMS instance. The value of this ENV is for services with LMTP that aren't DMS based AFAIK? It might be relevant to deprecate the ENV and drop it in the future (deferring topostfix-main.cfor similar) if rarely used?Additional info
Background (History)
postfix-main.cfoverride feature (available since Mar 2016). Using ENV instead was justified by the contributor as a convenience to skip providing a config file.main.cfupdate with the value of the 2nd ENV).Removing entire config dir for this test in favor of
user-patches.shI've identified none of it was relevant to the test except a few files. Only one of those actually had an effect.
Only relevant changes in test config regarding LMTP:
/etc/dovecot/dovecot.conf(protocols = imap lmtp) and/etc/dovecot/protocols.d/(protocols = $protocols lmtp).conf.d/10-master.confonly changed the LMTP service listener from a unix socket to TCP on port 24 (This was the only change required for the test to pass).None of those configs are required as:
protocols = imap pop3 lmtpis the upstream default, no need to addlmtp.user-patches.sh.Misc changes
Removed comment from
mail_hostname.batsIn an old PR I was not familiar with LMTP or the relevance of the comment in this test file. I lacked time back then to investigate to know if it was ok to remove it 😅
There was a comment 'postfix virtual transport lmtp' followed by two lines sending mail. This came from this commit
(from a PR in Oct 2020).
There's no value from that comment, as the email sent is for generic testing, nothing to do with LMTP (Likely transferred over from
test.batsat the time by accident).smtp-delivery.batsSimilar logic to match delivery logs. Figured I'd keep that in sync, and reduced the horizontal scroll for the command by extracting out the matching and formatting parts into vars. Added an example comment if helpful.
Type of change
Checklist:
docs/)