mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
75ee0c1145
- Introduced `CONTAINER_NAME` and `TEST_NAME_PREFIX` as new vars for better managing test consistency (DRY). - `CONTAINER_NAME` replaces any repeated container name with the variable. The value will differ slightly as the prior prefix (`mail_`) has been changed to `dms-test-`. - `TEST_NAME_PREFIX` provides a prefix value for each `@test` description string. --- chore: Add a reference template for tests
24 lines
828 B
Bash
24 lines
828 B
Bash
load "${REPOSITORY_ROOT}/test/helper/setup"
|
|
load "${REPOSITORY_ROOT}/test/helper/common"
|
|
|
|
TEST_NAME_PREFIX='helper functions inside container:'
|
|
CONTAINER_NAME='dms-test-helper_functions'
|
|
|
|
function setup_file() {
|
|
init_with_defaults
|
|
common_container_setup
|
|
}
|
|
|
|
function teardown_file() { _default_teardown ; }
|
|
|
|
@test "${TEST_NAME_PREFIX} _sanitize_ipv4_to_subnet_cidr" {
|
|
_run_in_container bash -c "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 255.255.255.255/0"
|
|
assert_output "0.0.0.0/0"
|
|
|
|
_run_in_container bash -c "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 192.168.255.14/20"
|
|
assert_output "192.168.240.0/20"
|
|
|
|
_run_in_container bash -c "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 192.168.255.14/32"
|
|
assert_output "192.168.255.14/32"
|
|
}
|