2022-11-25 22:37:58 +00:00
|
|
|
load "${REPOSITORY_ROOT}/test/helper/setup"
|
|
|
|
load "${REPOSITORY_ROOT}/test/helper/common"
|
2021-09-13 08:09:01 +00:00
|
|
|
|
2022-11-25 21:59:14 +00:00
|
|
|
TEST_NAME_PREFIX='helper functions inside container:'
|
|
|
|
CONTAINER_NAME='dms-test-helper_functions'
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2022-11-25 21:59:14 +00:00
|
|
|
function setup_file() {
|
|
|
|
init_with_defaults
|
|
|
|
common_container_setup
|
2021-09-13 08:09:01 +00:00
|
|
|
}
|
|
|
|
|
2022-11-25 21:59:14 +00:00
|
|
|
function teardown_file() { _default_teardown ; }
|
2021-09-13 08:09:01 +00:00
|
|
|
|
2022-11-25 21:59:14 +00:00
|
|
|
@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"
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2022-11-25 21:59:14 +00:00
|
|
|
_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"
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2022-11-25 21:59:14 +00:00
|
|
|
_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"
|
2021-09-13 08:09:01 +00:00
|
|
|
}
|