diff options
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/035-logs.bats | 2 | ||||
-rw-r--r-- | test/system/065-cp.bats | 4 | ||||
-rw-r--r-- | test/system/130-kill.bats | 13 | ||||
-rw-r--r-- | test/system/200-pod.bats | 2 | ||||
-rw-r--r-- | test/system/500-networking.bats | 12 | ||||
-rw-r--r-- | test/system/helpers.bash | 14 |
6 files changed, 32 insertions, 15 deletions
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats index 97d984ef1..6b8d5fbc5 100644 --- a/test/system/035-logs.bats +++ b/test/system/035-logs.bats @@ -124,7 +124,7 @@ function _log_test_restarted() { # FIXME: #9597 # run/start is flaking for remote so let's wait for the container condition # to stop wasting energy until the root cause gets fixed. - run_podman container wait --condition=exited logtest + run_podman container wait --condition=exited --condition=stopped logtest run_podman ${events_backend} start -a logtest logfile=$(mktemp -p ${PODMAN_TMPDIR} logfileXXXXXXXX) $PODMAN $_PODMAN_TEST_OPTS ${events_backend} logs -f logtest > $logfile diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats index 12c6e1a01..8f5abd228 100644 --- a/test/system/065-cp.bats +++ b/test/system/065-cp.bats @@ -66,7 +66,7 @@ load helpers # Container (parent) path does not exist. run_podman 125 cp $srcdir/hostfile0 cpcontainer:/IdoNotExist/ - is "$output" 'Error: "/IdoNotExist/" could not be found on container cpcontainer: No such file or directory' \ + is "$output" 'Error: "/IdoNotExist/" could not be found on container cpcontainer: no such file or directory' \ "copy into nonexistent path in container" run_podman kill cpcontainer @@ -794,7 +794,7 @@ ${randomcontent[1]}" "$description" is "$output" "" "output from podman cp 1" run_podman 125 cp --pause=false $srcdir/$rand_filename2 cpcontainer:/tmp/d2/x/ - is "$output" 'Error: "/tmp/d2/x/" could not be found on container cpcontainer: No such file or directory' "cp will not create nonexistent destination directory" + is "$output" 'Error: "/tmp/d2/x/" could not be found on container cpcontainer: no such file or directory' "cp will not create nonexistent destination directory" run_podman cp --pause=false $srcdir/$rand_filename3 cpcontainer:/tmp/d3/x is "$output" "" "output from podman cp 3" diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats index 96b633a42..7522c475d 100644 --- a/test/system/130-kill.bats +++ b/test/system/130-kill.bats @@ -133,11 +133,22 @@ load helpers @test "podman kill - concurrent stop" { # 14761 - concurrent kill/stop must record the exit code random_name=$(random_string 10) - run_podman run -d --replace --name=$random_name alpine sh -c "trap 'echo Received SIGTERM, ignoring' SIGTERM; echo READY; while :; do sleep 0.2; done" + run_podman run -d --replace --name=$random_name $IMAGE sh -c "trap 'echo Received SIGTERM, ignoring' SIGTERM; echo READY; while :; do sleep 0.2; done" $PODMAN stop -t 1 $random_name & run_podman kill $random_name run_podman wait $random_name run_podman rm -f $random_name } +@test "podman wait - exit codes" { + random_name=$(random_string 10) + run_podman create --name=$random_name $IMAGE /no/such/command + # Container never ran -> exit code == 0 + run_podman wait $random_name + # Container did not start successfully -> exit code != 0 + run_podman 125 start $random_name + # FIXME(#14873): while older Podmans return 0 on wait, Docker does not. + run_podman wait $random_name +} + # vim: filetype=sh diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index 0e522b34d..b93f3f92f 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -332,7 +332,7 @@ EOF @test "podman pod create --share" { local pod_name="$(random_string 10 | tr A-Z a-z)" run_podman 125 pod create --share bogus --name $pod_name - is "$output" ".*Invalid kernel namespace to share: bogus. Options are: cgroup, ipc, net, pid, uts or none" \ + is "$output" ".*invalid kernel namespace to share: bogus. Options are: cgroup, ipc, net, pid, uts or none" \ "pod test for bogus --share option" run_podman pod create --share ipc --name $pod_name run_podman pod inspect $pod_name --format "{{.SharedNamespaces}}" diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats index 0d724985e..50eb15216 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -677,16 +677,20 @@ EOF @test "podman run port forward range" { for netmode in bridge slirp4netns:port_handler=slirp4netns slirp4netns:port_handler=rootlesskit; do local range=$(random_free_port_range 3) - local port="${test%-*}" - local end_port="${test#-*}" + # die() inside $(...) does not actually stop us. + assert "$range" != "" "Could not find free port range" + + local port="${range%-*}" + local end_port="${range#*-}" local random=$(random_string) run_podman run --network $netmode -p "$range:$range" -d $IMAGE sleep inf cid="$output" for port in $(seq $port $end_port); do run_podman exec -d $cid nc -l -p $port -e /bin/cat - # -w 1 adds a 1 second timeout, for some reason ubuntus ncat doesn't close the connection on EOF, - # other options to change this are not portable across distros but -w seems to work + # -w 1 adds a 1 second timeout. For some reason, ubuntu's ncat + # doesn't close the connection on EOF, and other options to + # change this are not portable across distros. -w seems to work. run nc -w 1 127.0.0.1 $port <<<$random is "$output" "$random" "ncat got data back (netmode=$netmode port=$port)" done diff --git a/test/system/helpers.bash b/test/system/helpers.bash index 273e8d2f5..ceac48036 100644 --- a/test/system/helpers.bash +++ b/test/system/helpers.bash @@ -299,15 +299,17 @@ function random_free_port_range() { local maxtries=10 while [[ $maxtries -gt 0 ]]; do local firstport=$(random_free_port) - local all_ports_free=1 - for i in $(seq 2 $size); do - if ! port_is_free $((firstport + $i)); then - all_ports_free= + local lastport= + for i in $(seq 1 $((size - 1))); do + lastport=$((firstport + i)) + if ! port_is_free $lastport; then + echo "# port $lastport is in use; trying another." >&3 + lastport= break fi done - if [[ -n "$all_ports_free" ]]; then - echo "$firstport-$((firstport + $size - 1))" + if [[ -n "$lastport" ]]; then + echo "$firstport-$lastport" return fi |