tests: Extract some test cases out from tests.bats#2980
Merged
polarathene merged 8 commits intodocker-mailserver:masterfrom Jan 6, 2023
Merged
tests: Extract some test cases out from tests.bats#2980polarathene merged 8 commits intodocker-mailserver:masterfrom
tests.bats#2980polarathene merged 8 commits intodocker-mailserver:masterfrom
Conversation
- ONEDIR volume support no longer relevant, this should have been dropped. - ClamAV ENV no longer relevant as related tests have been extracted already. - Same with the some of the SpamAssassin ENV config. - `VIRUSMAILS_DELETE_DELAY` is tested in the file, but doesn't use this ENV at all? (runs a separate instance to test the ENV instead) - Hostname updated in preparation for migrating to new test helpers. Relevant test lines referencing the hostname have likewise been updated.
ENV remains the same, but required adding `ENABLE_AMAVIS=1` to bring that back, while the following became redundant as they're now defaulting to explicitly disabled in the helper method: - `ENABLE_CLAMAV=0` - `LOG_LEVEL=debug` - `ENABLE_UPDATE_CHECK=0` - `--hostname` + `--tty` + standard `--volume` lines - `-e` option expanded to long-name `--env`, and all `\` dropped as no longer necessary. `wait_for_finished_setup_in_container` is now redundant thanks to `common_container_setup`.
Sieve test files relocated into `test/config/dovecot-sieve/` for better isolation. `dovecot.sieve` was not using the `reject` import, and we should not encourage it? (docs still do): https://support.tigertech.net/sieve#the-sieve-reject-jmp
Migrated to the standard template and copied over the original test cases with `_run_in_container` adjustment only. Identified minimum required ENV along with which mail is required for each test case.
- Disabled `ENABLE_SRS=1`, not necessary for these tests. - Added a SpamAssassin related test (X-SPAM headers) which requires `SA_TAG` to properly pass (or `ENABLE_SRS=1` to deliver into inbox). - Many lines with double quotes changed to single quote wrapping, and moving out `grep` filters into `assert_output --partial` lines instead. - Instead of `wc -l` making failures less helpful, switch to the helper method `_should_output_number_of_lines` - x2 `assert_output` with different EOF style of usage was not actually failing on tests when it should. Changed to assert partial output of each expected line, and count the number of lines instead. - Added additional comments related to the test cases with a `TODO` note about `SPAMASSASSIN_SPAM_TO_INBOX=1`. - Revised test case names, including using the common prefix var. - `tests.bats` no longer needs to send all these emails, no other test cases require them. This affects a test checking a `/mail` folder exists which has been corrected, and a quotas test case adjusted to expect an empty quota size output.
Slight improvement by additionally matching `postconf` output to verify the setting is properly applied.
Removes the need for SpamAssassin ENV in `tests.bats`.
casperklein
approved these changes
Jan 6, 2023
Comment on lines
+50
to
+52
| # TODO (move to clamav tests): For use when ClamAV is enabled: | ||
| # repeat_in_container_until_success_or_timeout 60 "${CONTAINER_NAME}" test -e /var/run/clamav/clamd.ctl | ||
| # _run_in_container bash -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-virus.txt" |
Member
There was a problem hiding this comment.
We can probably resolve this with a future PR :)
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
While working on tests, I noticed that some of the configs being mounted were adding a few seconds to the start-up time of each container. Notably
postfix-*anddovecot.confconfig files, which have been extracted out into their own tests with those files moved into a separate config folder.tests.batshas been adapted to the common setup helper, and removed ENV no longer required to run those tests. Future PRs will extract out more tests.Review may be easier via individual commit diffs and their associated commit messages describing relevant changes.
Commit message history for reference
Checklist: