tests(refactor): Extract mail account management tests from tests.bats#3055
Merged
polarathene merged 8 commits intodocker-mailserver:masterfrom Feb 3, 2023
Merged
Conversation
Standard test file format, the test cases have been copied over unmodified.
Revised test cases: - Some common test case logic extracted to test methods. - Update direct user management commands to use the `setup email ...` variants. - Improved assertions. - Removed `sleep 2` lines as the need for that is ambiguous (may no longer be relevant?) - Additional commentary for maintaining - Two test cases for missing `postfix-accounts.cf` opted to just run the image without any volumes instead, as the `without-accounts/` folder was empty anyway. 2nd test case can instead use a single `docker run` to check the newly created`postfix-accounts.cf` content. - `test/config/without-accounts/` remains as `open_dkim.bats` presently uses it.
Traced this back to the original PR where it appears to have been a typo and was probably intended as a cleanup on the `user4` account. Not necessary, removing.
georglauterbach
requested changes
Feb 3, 2023
Member
georglauterbach
left a comment
There was a problem hiding this comment.
We should take care of the parsing of ls and the directory checks; the rest looks very good!
Replace `ls -d` approach from original test cases Co-authored-by: Georg Lauterbach <[email protected]>
georglauterbach
approved these changes
Feb 3, 2023
casperklein
approved these changes
Feb 3, 2023
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
Test cases should remain mostly the same, except:
user4test, there was an account removal at the end that was probably a typo and intended asuser4as a clean-up step (original PR). I've dropped it as it doesn't seem necessary.sleep 2lines don't seem necessary so I've removed those.postfix-accounts.cfvia an alternative volume anddocker runwere refactored to not need that a all.tests.batshad two groups of "accounts" tests, I've separated them with some comment headers. The very first test didn't seem as thorough, and improving on that seems to have raised a bug? (_not entirely sure, just that it's related to the Dovecot dummy alias workaround, potentially related feature request [FR] Add the ability to redirect a domain catch-all to some user mailbox #3022 _)To assist with review, if helpful I've staged changes out into multiple commits improved diffs:
Some test cases could probably be collapsed or changed further, but this is good enough as an initial pass 👍
Type of change
Checklist: