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
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
BATS_TEST_NAME_PREFIX='[Scripts] (helper functions inside container) '
|
2023-01-03 05:58:09 +00:00
|
|
|
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() {
|
2023-01-21 23:05:28 +00:00
|
|
|
_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
|
|
|
|
2023-01-09 07:54:04 +00:00
|
|
|
@test "_sanitize_ipv4_to_subnet_cidr" {
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_bash "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 255.255.255.255/0"
|
2022-11-25 21:59:14 +00:00
|
|
|
assert_output "0.0.0.0/0"
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_bash "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 192.168.255.14/20"
|
2022-11-25 21:59:14 +00:00
|
|
|
assert_output "192.168.240.0/20"
|
2022-05-30 00:53:30 +00:00
|
|
|
|
2023-01-21 23:05:28 +00:00
|
|
|
_run_in_container_bash "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 192.168.255.14/32"
|
2022-11-25 21:59:14 +00:00
|
|
|
assert_output "192.168.255.14/32"
|
2021-09-13 08:09:01 +00:00
|
|
|
}
|