You've already forked docker-mailserver
mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-08 23:06:49 +02:00
update BATS & helper + minor updates to BATS variables (#2988)
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
load "${REPOSITORY_ROOT}/test/test_helper/common"
|
||||
|
||||
TEST_NAME_PREFIX='test helper functions:'
|
||||
BATS_TEST_NAME_PREFIX='test helper functions:'
|
||||
|
||||
@test "${TEST_NAME_PREFIX} repeat_until_success_or_timeout returns instantly on success" {
|
||||
@test "repeat_until_success_or_timeout returns instantly on success" {
|
||||
SECONDS=0
|
||||
repeat_until_success_or_timeout 1 true
|
||||
[[ ${SECONDS} -le 1 ]]
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} repeat_until_success_or_timeout waits for timeout on persistent failure" {
|
||||
@test "repeat_until_success_or_timeout waits for timeout on persistent failure" {
|
||||
SECONDS=0
|
||||
run repeat_until_success_or_timeout 2 false
|
||||
[[ ${SECONDS} -ge 2 ]]
|
||||
@ -16,7 +16,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_output --partial "Timed out on command"
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} repeat_until_success_or_timeout aborts immediately on fatal failure" {
|
||||
@test "repeat_until_success_or_timeout aborts immediately on fatal failure" {
|
||||
SECONDS=0
|
||||
run repeat_until_success_or_timeout --fatal-test false 2 false
|
||||
[[ ${SECONDS} -le 1 ]]
|
||||
@ -24,7 +24,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_output --partial "early aborting"
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} repeat_until_success_or_timeout expects integer timeout" {
|
||||
@test "repeat_until_success_or_timeout expects integer timeout" {
|
||||
run repeat_until_success_or_timeout 1 true
|
||||
assert_success
|
||||
|
||||
@ -35,27 +35,27 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} run_until_success_or_timeout returns instantly on success" {
|
||||
@test "run_until_success_or_timeout returns instantly on success" {
|
||||
SECONDS=0
|
||||
run_until_success_or_timeout 2 true
|
||||
[[ ${SECONDS} -le 1 ]]
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} run_until_success_or_timeout waits for timeout on persistent failure" {
|
||||
@test "run_until_success_or_timeout waits for timeout on persistent failure" {
|
||||
SECONDS=0
|
||||
! run_until_success_or_timeout 2 false
|
||||
[[ ${SECONDS} -ge 2 ]]
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} repeat_in_container_until_success_or_timeout fails immediately for non-running container" {
|
||||
@test "repeat_in_container_until_success_or_timeout fails immediately for non-running container" {
|
||||
SECONDS=0
|
||||
! repeat_in_container_until_success_or_timeout 10 name-of-non-existing-container true
|
||||
[[ ${SECONDS} -le 1 ]]
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} repeat_in_container_until_success_or_timeout run command in container" {
|
||||
@test "repeat_in_container_until_success_or_timeout run command in container" {
|
||||
local CONTAINER_NAME
|
||||
CONTAINER_NAME=$(docker run --rm -d alpine sleep 100)
|
||||
SECONDS=0
|
||||
@ -65,7 +65,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_output "${CONTAINER_NAME}"
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} container_is_running" {
|
||||
@test "container_is_running" {
|
||||
local CONTAINER_NAME
|
||||
CONTAINER_NAME=$(docker run --rm -d alpine sleep 100)
|
||||
container_is_running "${CONTAINER_NAME}"
|
||||
@ -73,7 +73,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
! container_is_running "${CONTAINER_NAME}"
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} wait_for_smtp_port_in_container aborts wait after timeout" {
|
||||
@test "wait_for_smtp_port_in_container aborts wait after timeout" {
|
||||
local CONTAINER_NAME
|
||||
CONTAINER_NAME=$(docker run --rm -d alpine sleep 100)
|
||||
SECONDS=0
|
||||
@ -84,7 +84,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
}
|
||||
|
||||
# NOTE: Test requires external network access available
|
||||
@test "${TEST_NAME_PREFIX} wait_for_smtp_port_in_container returns immediately when port found" {
|
||||
@test "wait_for_smtp_port_in_container returns immediately when port found" {
|
||||
local CONTAINER_NAME
|
||||
CONTAINER_NAME=$(docker run --rm -d alpine sh -c "sleep 100")
|
||||
|
||||
@ -97,7 +97,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} wait_for_finished_setup_in_container" {
|
||||
@test "wait_for_finished_setup_in_container" {
|
||||
# variable not local to make visible to teardown
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG=$(duplicate_config_for_container .)
|
||||
@ -119,7 +119,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
[[ ${SECONDS} -gt 0 ]]
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} duplicate_config_for_container" {
|
||||
@test "duplicate_config_for_container" {
|
||||
local path
|
||||
path=$(duplicate_config_for_container duplicate_config_test)
|
||||
|
||||
@ -130,7 +130,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} container_has_service_running/wait_for_service" {
|
||||
@test "container_has_service_running/wait_for_service" {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG=$(duplicate_config_for_container .)
|
||||
|
||||
@ -158,7 +158,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} wait_for_changes_to_be_detected_in_container fails when timeout is reached" {
|
||||
@test "wait_for_changes_to_be_detected_in_container fails when timeout is reached" {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG=$(duplicate_config_for_container .)
|
||||
|
||||
@ -184,7 +184,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
! TEST_TIMEOUT_IN_SECONDS=0 wait_for_changes_to_be_detected_in_container "${CONTAINER_NAME}"
|
||||
}
|
||||
|
||||
@test "${TEST_NAME_PREFIX} wait_for_changes_to_be_detected_in_container succeeds within timeout" {
|
||||
@test "wait_for_changes_to_be_detected_in_container succeeds within timeout" {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG=$(duplicate_config_for_container .)
|
||||
|
||||
@ -210,7 +210,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
}
|
||||
|
||||
# TODO investigate why this test fails
|
||||
@test "${TEST_NAME_PREFIX} wait_for_empty_mail_queue_in_container fails when timeout reached" {
|
||||
@test "wait_for_empty_mail_queue_in_container fails when timeout reached" {
|
||||
skip 'disabled as it fails randomly: https://github.com/docker-mailserver/docker-mailserver/pull/2177'
|
||||
|
||||
local PRIVATE_CONFIG
|
||||
@ -242,7 +242,7 @@ TEST_NAME_PREFIX='test helper functions:'
|
||||
}
|
||||
|
||||
# TODO investigate why this test fails
|
||||
@test "${TEST_NAME_PREFIX} wait_for_empty_mail_queue_in_container succeeds within timeout" {
|
||||
@test "wait_for_empty_mail_queue_in_container succeeds within timeout" {
|
||||
skip 'disabled as it fails randomly: https://github.com/docker-mailserver/docker-mailserver/pull/2177'
|
||||
|
||||
local PRIVATE_CONFIG
|
||||
|
Reference in New Issue
Block a user