mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 01:55:29 +02:00
update BATS & helper + minor updates to BATS variables (#2988)
This commit is contained in:
parent
2b4105ef0a
commit
41c44cb91d
24 changed files with 137 additions and 136 deletions
|
@ -1,7 +1,7 @@
|
|||
load "${REPOSITORY_ROOT}/test/helper/setup"
|
||||
load "${REPOSITORY_ROOT}/test/helper/common"
|
||||
|
||||
TEST_NAME_PREFIX='[Security] TLS (cipher lists):'
|
||||
BATS_TEST_NAME_PREFIX='[Security] (TLS) (cipher lists) '
|
||||
CONTAINER_PREFIX='dms-test_tls-cipherlists'
|
||||
|
||||
# NOTE: Tests cases here cannot be run concurrently:
|
||||
|
@ -38,34 +38,34 @@ function teardown_file() {
|
|||
|
||||
function teardown() { _default_teardown ; }
|
||||
|
||||
@test "${TEST_NAME_PREFIX} 'TLS_LEVEL=intermediate' + RSA" {
|
||||
@test "'TLS_LEVEL=intermediate' + RSA" {
|
||||
configure_and_run_dms_container 'intermediate' 'rsa'
|
||||
should_support_expected_cipherlists
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} 'TLS_LEVEL=intermediate' + ECDSA" {
|
||||
@test "'TLS_LEVEL=intermediate' + ECDSA" {
|
||||
configure_and_run_dms_container 'intermediate' 'ecdsa'
|
||||
should_support_expected_cipherlists
|
||||
}
|
||||
|
||||
# Only ECDSA with an RSA fallback is tested.
|
||||
# There isn't a situation where RSA with an ECDSA fallback would make sense.
|
||||
@test "${TEST_NAME_PREFIX} 'TLS_LEVEL=intermediate' + ECDSA with RSA fallback" {
|
||||
@test "'TLS_LEVEL=intermediate' + ECDSA with RSA fallback" {
|
||||
configure_and_run_dms_container 'intermediate' 'ecdsa' 'rsa'
|
||||
should_support_expected_cipherlists
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} 'TLS_LEVEL=modern' + RSA" {
|
||||
@test "'TLS_LEVEL=modern' + RSA" {
|
||||
configure_and_run_dms_container 'modern' 'rsa'
|
||||
should_support_expected_cipherlists
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} 'TLS_LEVEL=modern' + ECDSA" {
|
||||
@test "'TLS_LEVEL=modern' + ECDSA" {
|
||||
configure_and_run_dms_container 'modern' 'ecdsa'
|
||||
should_support_expected_cipherlists
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} 'TLS_LEVEL=modern' + ECDSA with RSA fallback" {
|
||||
@test "'TLS_LEVEL=modern' + ECDSA with RSA fallback" {
|
||||
configure_and_run_dms_container 'modern' 'ecdsa' 'rsa'
|
||||
should_support_expected_cipherlists
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ load "${REPOSITORY_ROOT}/test/helper/setup"
|
|||
load "${REPOSITORY_ROOT}/test/helper/common"
|
||||
load "${REPOSITORY_ROOT}/test/helper/tls"
|
||||
|
||||
TEST_NAME_PREFIX='[Security] TLS (SSL_TYPE=letsencrypt):'
|
||||
BATS_TEST_NAME_PREFIX='[Security] (TLS) (SSL_TYPE=letsencrypt) '
|
||||
CONTAINER1_NAME='dms-test_tls-letsencrypt_default-hostname'
|
||||
CONTAINER2_NAME='dms-test_tls-letsencrypt_fallback-domainname'
|
||||
CONTAINER3_NAME='dms-test_tls-letsencrypt_support-acme-json'
|
||||
|
@ -30,7 +30,7 @@ function _initial_setup() {
|
|||
}
|
||||
|
||||
# Should detect and choose the cert for FQDN `mail.example.test` (HOSTNAME):
|
||||
@test "${TEST_NAME_PREFIX} Should default to HOSTNAME (${TEST_FQDN})" {
|
||||
@test "Should default to HOSTNAME (${TEST_FQDN})" {
|
||||
export CONTAINER_NAME=${CONTAINER1_NAME}
|
||||
_initial_setup
|
||||
|
||||
|
@ -50,7 +50,7 @@ function _initial_setup() {
|
|||
|
||||
# Should detect and choose cert for FQDN `example.test` (DOMAINNAME),
|
||||
# as fallback when no cert for FQDN `mail.example.test` (HOSTNAME) exists:
|
||||
@test "${TEST_NAME_PREFIX} Should fallback to DOMAINNAME (example.test)" {
|
||||
@test "Should fallback to DOMAINNAME (example.test)" {
|
||||
export CONTAINER_NAME=${CONTAINER2_NAME}
|
||||
_initial_setup
|
||||
|
||||
|
@ -75,7 +75,7 @@ function _initial_setup() {
|
|||
# all Subject CN (`main` in acme.json) are `Smallstep Leaf` which is not an FQDN.
|
||||
# While not using a FQDN is valid for that field,
|
||||
# it does mean there is no test coverage against the `acme.json` field `main`.
|
||||
@test "${TEST_NAME_PREFIX} Traefik 'acme.json' (*.example.test)" {
|
||||
@test "Traefik 'acme.json' (*.example.test)" {
|
||||
export CONTAINER_NAME=${CONTAINER3_NAME}
|
||||
_initial_setup
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
load "${REPOSITORY_ROOT}/test/helper/setup"
|
||||
load "${REPOSITORY_ROOT}/test/helper/common"
|
||||
|
||||
TEST_NAME_PREFIX='[Security] TLS (SSL_TYPE=manual):'
|
||||
BATS_TEST_NAME_PREFIX='[Security] (TLS) (SSL_TYPE=manual) '
|
||||
CONTAINER_NAME='dms-test_tls-manual'
|
||||
|
||||
function setup_file() {
|
||||
|
@ -38,7 +38,7 @@ function setup_file() {
|
|||
|
||||
function teardown_file() { _default_teardown ; }
|
||||
|
||||
@test "${TEST_NAME_PREFIX} ENV vars provided are valid files" {
|
||||
@test "ENV vars provided are valid files" {
|
||||
_run_in_container [ -f "${SSL_CERT_PATH}" ]
|
||||
assert_success
|
||||
|
||||
|
@ -52,7 +52,7 @@ function teardown_file() { _default_teardown ; }
|
|||
assert_success
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} manual configuration is correct" {
|
||||
@test "manual configuration is correct" {
|
||||
local DOVECOT_CONFIG_SSL='/etc/dovecot/conf.d/10-ssl.conf'
|
||||
|
||||
_run_in_container grep '^smtpd_tls_chain_files =' '/etc/postfix/main.cf'
|
||||
|
@ -76,7 +76,7 @@ function teardown_file() { _default_teardown ; }
|
|||
assert_output "ssl_alt_cert = <${FALLBACK_CERT}"
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} manual configuration copied files correctly " {
|
||||
@test "manual configuration copied files correctly " {
|
||||
_run_in_container cmp -s "${PRIMARY_KEY}" "${SSL_KEY_PATH}"
|
||||
assert_success
|
||||
_run_in_container cmp -s "${PRIMARY_CERT}" "${SSL_CERT_PATH}"
|
||||
|
@ -89,7 +89,7 @@ function teardown_file() { _default_teardown ; }
|
|||
assert_success
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} manual cert works correctly" {
|
||||
@test "manual cert works correctly" {
|
||||
wait_for_tcp_port_in_container 587 "${CONTAINER_NAME}"
|
||||
|
||||
local TEST_COMMAND=(timeout 1 openssl s_client -connect mail.example.test:587 -starttls smtp)
|
||||
|
@ -106,7 +106,7 @@ function teardown_file() { _default_teardown ; }
|
|||
assert_equal "${RESULT}" 'Verification: OK'
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} manual cert changes are picked up by check-for-changes" {
|
||||
@test "manual cert changes are picked up by check-for-changes" {
|
||||
printf '%s' 'someThingsChangedHere' \
|
||||
>>"$(pwd)/test/test-files/ssl/${TEST_DOMAIN}/with_ca/ecdsa/key.ecdsa.pem"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue