1
0
mirror of https://github.com/docker-mailserver/docker-mailserver.git synced 2025-08-10 23:12:02 +02:00

update BATS & helper + minor updates to BATS variables (#2988)

This commit is contained in:
Georg Lauterbach
2023-01-09 08:54:04 +01:00
committed by GitHub
parent 2b4105ef0a
commit 41c44cb91d
24 changed files with 137 additions and 136 deletions

View File

@@ -1,7 +1,7 @@
load "${REPOSITORY_ROOT}/test/helper/setup"
load "${REPOSITORY_ROOT}/test/helper/common"
TEST_NAME_PREFIX='ClamAV:'
BATS_TEST_NAME_PREFIX='[ClamAV] '
CONTAINER_NAME='dms-test_clamav'
function setup_file() {
@@ -34,38 +34,38 @@ function setup_file() {
function teardown_file() { _default_teardown ; }
@test "${TEST_NAME_PREFIX} process clamd is running" {
@test "process clamd is running" {
run check_if_process_is_running 'clamd'
assert_success
}
@test "${TEST_NAME_PREFIX} log files exist at /var/log/mail directory" {
@test "log files exist at /var/log/mail directory" {
_run_in_container bash -c "ls -1 /var/log/mail/ | grep -E 'clamav|freshclam|mail.log' | wc -l"
assert_success
assert_output 3
}
@test "${TEST_NAME_PREFIX} should be identified by Amavis" {
@test "should be identified by Amavis" {
_run_in_container grep -i 'Found secondary av scanner ClamAV-clamscan' /var/log/mail/mail.log
assert_success
}
@test "${TEST_NAME_PREFIX} freshclam cron is enabled" {
@test "freshclam cron is enabled" {
_run_in_container bash -c "grep '/usr/bin/freshclam' -r /etc/cron.d"
assert_success
}
@test "${TEST_NAME_PREFIX} env CLAMAV_MESSAGE_SIZE_LIMIT is set correctly" {
@test "env CLAMAV_MESSAGE_SIZE_LIMIT is set correctly" {
_run_in_container grep -q '^MaxFileSize 30M$' /etc/clamav/clamd.conf
assert_success
}
@test "${TEST_NAME_PREFIX} rejects virus" {
@test "rejects virus" {
_run_in_container bash -c "grep 'Blocked INFECTED' /var/log/mail/mail.log | grep '<virus@external.tld> -> <user1@localhost.localdomain>'"
assert_success
}
@test "${TEST_NAME_PREFIX} process clamd restarts when killed" {
@test "process clamd restarts when killed" {
_run_in_container pkill 'clamd'
assert_success