docker-postfix/unit-tests/test-multi-comment.bats
Bojan Čekrlić cf2b2be0d3 Remove references to hash: databases
With upgrade to Alpine 3.13, support for `hash:` and `btree:` has
beenremoved from Alpine.

As such `hash:<file>` references do not work any more.

[Alpine](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0)
explains it like this:

> Oracle has changed the license of BDB to AGPL-3.0, making it unsuitable
> to link to packages with GPL-incompatible licenses. Since the old version
> is no longer maintained, the db package is now deprecated. Alpine Linux
> packages are being transitioned to alternatives or, where no alternatives
> exist, removed entirely.

This, unfortunately, will mean that the new version of `docker-postfix`
might not be backwards-compatible, if you're using your own postfix
configuration. Sorry. :-(
2021-02-07 23:07:39 +01:00

70 lines
No EOL
2.1 KiB
Bash

#!/usr/bin/env bats
load /code/scripts/common.sh
load /code/scripts/common-run.sh
if [[ ! -f /etc/postfix/main.test-multi-comment ]]; then
cp /etc/postfix/main.cf /etc/postfix/main.test-multi-comment
fi
@test "make sure #myhostname appears four times in main.cf (default)" {
result=$(grep -E "^#myhostname" /etc/postfix/main.cf | wc -l)
[[ "$result" -gt 1 ]]
}
@test "make sure commenting out #myhostname does not incrase count" {
COMMENT_COUNT=$(grep -E "^#myhostname" /etc/postfix/main.test-multi-comment | wc -l)
do_postconf -# myhostname
postfix check
result=$(grep -E "^#myhostname" /etc/postfix/main.cf | wc -l)
[ "$result" == "$COMMENT_COUNT" ]
}
@test "make sure adding myhostname does not incrase count" {
COMMENT_COUNT=$(grep -E "^#myhostname" /etc/postfix/main.test-multi-comment | wc -l)
do_postconf -e myhostname=localhost
postfix check
result=$(grep -E "^#myhostname" /etc/postfix/main.cf | wc -l)
[ "$result" == "$COMMENT_COUNT" ]
}
@test "make sure adding myhostname is added only once" {
do_postconf -e myhostname=localhost
postfix check
result=$(grep -E "^myhostname" /etc/postfix/main.cf | wc -l)
[ "$result" == "1" ]
}
@test "make sure deleting myhostname does not incrase count" {
COMMENT_COUNT=$(grep -E "^#myhostname" /etc/postfix/main.test-multi-comment | wc -l)
do_postconf -# myhostname
postfix check
result=$(grep -E "^#myhostname" /etc/postfix/main.cf | wc -l)
[ "$result" == "$COMMENT_COUNT" ]
}
@test "test removing relayhost" {
do_postconf -# relayhost
grep -q -E "^#relayhost" /etc/postfix/main.cf
! grep -q -E "^relayhost" /etc/postfix/main.cf
postfix check
}
@test "spaces in parameters" {
do_postconf -e "smtpd_recipient_restrictions=reject_non_fqdn_recipient, reject_unknown_recipient_domain, check_sender_access lmdb:example.org, reject"
postfix check
}
@test "no sasl password duplications" {
local RELAYHOST="demo"
local RELAYHOST_USERNAME="foo"
local RELAYHOST_PASSWORD="bar"
postfix_setup_relayhost
postfix_setup_relayhost
postfix check
result=$(grep -E "^demo" /etc/postfix/sasl_passwd | wc -l)
[ "$result" == "1" ]
}