diff --git a/test/system/103-container.bats b/test/system/103-container.bats index e442db17e..9e87bccbe 100644 --- a/test/system/103-container.bats +++ b/test/system/103-container.bats @@ -19,23 +19,30 @@ teardown() { create_default_container - run $PODMAN start $CONTAINER_NAME - - CONTAINER_INITIALIZED=0 - - for TRIES in 1 2 3 4 5 - do - run $PODMAN logs $CONTAINER_NAME - CONTAINER_OUTPUT=$output - run grep 'Listening to file system and ticker events' <<< $CONTAINER_OUTPUT - if [[ "$status" -eq 0 ]]; then - CONTAINER_INITIALIZED=1 - break - fi - sleep 1 - done - - echo $CONTAINER_OUTPUT - assert [ "$CONTAINER_INITIALIZED" -eq 1 ] + res="$(container_started $CONTAINER_NAME)" + + assert [ "$res" -eq 1 ] } +@test "container(Fedora Rawhide): Containers with supported versions start without issues" { + local os_release="$(find_os_release)" + local system_id="$(get_system_id)" + local system_version="$(get_system_version)" + local rawhide_res="$(awk '/rawhide/' $os_release)" + + if [ "$system_id" != "fedora" ] || [ -z "$rawhide_res" ]; then + skip "This test is only for Fedora Rawhide" + fi + + create_distro_container "$system_id" "$system_version" latest + create_distro_container "$system_id" "$((system_version-1))" second + create_distro_container "$system_id" "$((system_version-2))" third + + res1="$(container_started latest)" + res2="$(container_started second)" + res3="$(container_started third)" + + assert [ "$res1" -eq 1 ] + assert [ "$res2" -eq 1 ] + assert [ "$res3" -eq 1 ] +} diff --git a/test/system/libs/helpers.bash b/test/system/libs/helpers.bash index 883d80e37..1f6579e42 100644 --- a/test/system/libs/helpers.bash +++ b/test/system/libs/helpers.bash @@ -208,6 +208,38 @@ function start_container() { } +# Checks if a toolbox container started +# +# Parameters: +# =========== +# - container_name - name of the container +function container_started() { + local container_name + + container_name="$1" + + run $PODMAN start $container_name + + container_initialized=0 + + for TRIES in 1 2 3 4 5 + do + run $PODMAN logs $container_name + container_output=$output + run grep 'Listening to file system and ticker events' <<< $container_output + if [[ "$status" -eq 0 ]]; then + container_initialized=1 + break + fi + sleep 1 + done + + echo $container_output >2 + + echo $container_initialized +} + + function stop_container() { local container_name container_name="$1"