mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
tests: Replace wc -l
with grep -c
(#3752)
This commit is contained in:
parent
6082d5f8d0
commit
0eb4ac7714
|
@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. The format
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
- **Internal:**
|
- **Internal:**
|
||||||
|
- tests: Replace `wc -l` with `grep -c` ([#3752](https://github.com/docker-mailserver/docker-mailserver/pull/3752))
|
||||||
- Postfix is now configured with `smtputf8_enable = no` in our default `main.cf` config (_instead of during container startup_). ([#3750](https://github.com/docker-mailserver/docker-mailserver/pull/3750))
|
- Postfix is now configured with `smtputf8_enable = no` in our default `main.cf` config (_instead of during container startup_). ([#3750](https://github.com/docker-mailserver/docker-mailserver/pull/3750))
|
||||||
- **Rspamd** ([#3726](https://github.com/docker-mailserver/docker-mailserver/pull/3726)):
|
- **Rspamd** ([#3726](https://github.com/docker-mailserver/docker-mailserver/pull/3726)):
|
||||||
- symbol scores for SPF, DKIM & DMARC were updated to more closely align with [RFC7489](https://www.rfc-editor.org/rfc/rfc7489#page-24); please note though that complete alignment is undesirable, because other symbols might be added as well, which changes the overall score calculation again, see [this issue](https://github.com/docker-mailserver/docker-mailserver/issues/3690#issuecomment-1866871996)
|
- symbol scores for SPF, DKIM & DMARC were updated to more closely align with [RFC7489](https://www.rfc-editor.org/rfc/rfc7489#page-24); please note though that complete alignment is undesirable, because other symbols might be added as well, which changes the overall score calculation again, see [this issue](https://github.com/docker-mailserver/docker-mailserver/issues/3690#issuecomment-1866871996)
|
||||||
|
|
|
@ -33,7 +33,7 @@ function setup_file() {
|
||||||
function teardown_file() { _default_teardown ; }
|
function teardown_file() { _default_teardown ; }
|
||||||
|
|
||||||
@test 'log files exist at /var/log/mail directory' {
|
@test 'log files exist at /var/log/mail directory' {
|
||||||
_run_in_container_bash "ls -1 /var/log/mail/ | grep -E 'clamav|freshclam|mail.log' | wc -l"
|
_run_in_container_bash "ls -1 /var/log/mail/ | grep -c -E 'clamav|freshclam|mail.log'"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output 3
|
assert_output 3
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,12 +204,12 @@ function teardown_file() { _default_teardown ; }
|
||||||
run ./setup.sh -c "${CONTAINER_NAME}" quota set quota_user2 51M
|
run ./setup.sh -c "${CONTAINER_NAME}" quota set quota_user2 51M
|
||||||
assert_failure
|
assert_failure
|
||||||
|
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -E '^quota_user@example.com\:12M\$' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -c -E '^quota_user@example.com\:12M\$' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run ./setup.sh -c "${CONTAINER_NAME}" quota set quota_user@example.com 26M
|
run ./setup.sh -c "${CONTAINER_NAME}" quota set quota_user@example.com 26M
|
||||||
assert_success
|
assert_success
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -E '^quota_user@example.com\:26M\$' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -c -E '^quota_user@example.com\:26M\$' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run grep "quota_user2@example.com" "${TEST_TMP_CONFIG}/dovecot-quotas.cf"
|
run grep "quota_user2@example.com" "${TEST_TMP_CONFIG}/dovecot-quotas.cf"
|
||||||
|
@ -220,12 +220,12 @@ function teardown_file() { _default_teardown ; }
|
||||||
@test "delquota" {
|
@test "delquota" {
|
||||||
run ./setup.sh -c "${CONTAINER_NAME}" quota set quota_user@example.com 12M
|
run ./setup.sh -c "${CONTAINER_NAME}" quota set quota_user@example.com 12M
|
||||||
assert_success
|
assert_success
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -E '^quota_user@example.com\:12M\$' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -c -E '^quota_user@example.com\:12M\$' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run ./setup.sh -c "${CONTAINER_NAME}" quota del unknown@domain.com
|
run ./setup.sh -c "${CONTAINER_NAME}" quota del unknown@domain.com
|
||||||
assert_failure
|
assert_failure
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -E '^quota_user@example.com\:12M\$' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/dovecot-quotas.cf | grep -c -E '^quota_user@example.com\:12M\$' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
run ./setup.sh -c "${CONTAINER_NAME}" quota del quota_user@example.com
|
run ./setup.sh -c "${CONTAINER_NAME}" quota del quota_user@example.com
|
||||||
|
@ -260,13 +260,13 @@ function teardown_file() { _default_teardown ; }
|
||||||
./setup.sh -c "${CONTAINER_NAME}" relay add-domain example3.org smtp.relay.com 587
|
./setup.sh -c "${CONTAINER_NAME}" relay add-domain example3.org smtp.relay.com 587
|
||||||
|
|
||||||
# check adding
|
# check adding
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -e '^@example1.org\s\+\[smtp.relay1.com\]:2525' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -c -e '^@example1.org\s\+\[smtp.relay1.com\]:2525' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
# test default port
|
# test default port
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -e '^@example2.org\s\+\[smtp.relay2.com\]:25' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -c -e '^@example2.org\s\+\[smtp.relay2.com\]:25' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
# test modifying
|
# test modifying
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -e '^@example3.org\s\+\[smtp.relay.com\]:587' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -c -e '^@example3.org\s\+\[smtp.relay.com\]:587' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,16 +276,16 @@ function teardown_file() { _default_teardown ; }
|
||||||
./setup.sh -c "${CONTAINER_NAME}" relay add-auth example2.org smtp_user2 smtp_pass_new
|
./setup.sh -c "${CONTAINER_NAME}" relay add-auth example2.org smtp_user2 smtp_pass_new
|
||||||
|
|
||||||
# test adding
|
# test adding
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-sasl-password.cf | grep -e '^@example.org\s\+smtp_user:smtp_pass' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-sasl-password.cf | grep -c -e '^@example.org\s\+smtp_user:smtp_pass' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
# test updating
|
# test updating
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-sasl-password.cf | grep -e '^@example2.org\s\+smtp_user2:smtp_pass_new' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-sasl-password.cf | grep -c -e '^@example2.org\s\+smtp_user2:smtp_pass_new' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "relay exclude-domain" {
|
@test "relay exclude-domain" {
|
||||||
./setup.sh -c "${CONTAINER_NAME}" relay exclude-domain example.org
|
./setup.sh -c "${CONTAINER_NAME}" relay exclude-domain example.org
|
||||||
|
|
||||||
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -e '^@example.org\s*$' | wc -l | grep 1"
|
run /bin/sh -c "cat ${TEST_TMP_CONFIG}/postfix-relaymap.cf | grep -c -e '^@example.org\s*$' | grep 1"
|
||||||
assert_success
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ EOF
|
||||||
#
|
#
|
||||||
|
|
||||||
@test "amavis: config overrides" {
|
@test "amavis: config overrides" {
|
||||||
_run_in_container_bash "grep 'Test Verification' /etc/amavis/conf.d/50-user | wc -l"
|
_run_in_container_bash "grep -c 'Test Verification' /etc/amavis/conf.d/50-user"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output 1
|
assert_output 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue