Refactored.
This commit is contained in:
parent
be5feec1be
commit
e57724befd
9
Makefile
9
Makefile
|
@ -55,15 +55,8 @@ fixtures:
|
|||
|
||||
tests:
|
||||
# Start tests
|
||||
# ifdef ENABLE_POP3
|
||||
# @echo "ENABLE_POP3 => $(ENABLE_POP3)"
|
||||
# ./test/bats/bats test/ENABLE_POP3_$(ENABLE_POP3).bats
|
||||
# endif
|
||||
# ifdef SASL_PASSWD
|
||||
# @echo "SASL_PASSWD => $(SASL_PASSWD)"
|
||||
# ./test/bats/bats test/SASL_PASSWD_$(SASL_PASSWD_).bats
|
||||
# endif
|
||||
./test/bats/bats test/ENABLE_POP3.bats
|
||||
./test/bats/bats test/SASL_PASSWD.bats
|
||||
|
||||
clean:
|
||||
# Remove running test container
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
@test "checking process: process is not running" {
|
||||
run docker exec mail /bin/bash -c "ps aux | grep 'dovecot/pop'"
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "checking pop: server does not respond on port 110" {
|
||||
run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110"
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
@test "checking pop: process is running" {
|
||||
run docker exec mail /bin/bash -c "ps aux | grep 'dovecot/pop'"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "checking pop: server responds on port 110" {
|
||||
run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110 | grep '+OK'"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "checking pop: authentication works" {
|
||||
run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 110 < /tmp/docker-mailserver-test/auth/pop3-auth.txt"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
####################################################################################################
|
||||
#
|
||||
# SASL_PASSWD provided
|
||||
#
|
||||
####################################################################################################
|
||||
|
||||
@test "checking sasl: doveadm auth test works with good password" {
|
||||
if [ -z "$SASL_PASSWD" ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld mypassword | grep 'auth succeeded'"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "checking sasl: doveadm auth test fails with bad password" {
|
||||
if [ -z "$SASL_PASSWD" ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld BADPASSWORD | grep 'auth failed'"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "checking sasl: sasl_passwd.db exists" {
|
||||
if [ -z "$SASL_PASSWD" ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
#
|
||||
# SASL_PASSWD not provided
|
||||
#
|
||||
####################################################################################################
|
||||
|
||||
@test "checking sasl: sasl_passwd.db should not exist" {
|
||||
if [ -n "$SASL_PASSWD" ]; then
|
||||
skip
|
||||
fi
|
||||
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
@test "checking sasl: sasl_passwd.db should not exist" {
|
||||
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
@test "checking sasl: doveadm auth test works with good password" {
|
||||
run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld mypassword | grep 'auth succeeded'"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "checking sasl: doveadm auth test fails with bad password" {
|
||||
run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld BADPASSWORD | grep 'auth failed'"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "checking sasl: sasl_passwd.db exists" {
|
||||
run docker exec mail [ -f /etc/postfix/sasl_passwd.db ]
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
Loading…
Reference in New Issue