diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-01 21:11:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 21:11:41 +0200 |
commit | d6bf6b92c8aba3195261e3bedd1d4f11a7210314 (patch) | |
tree | a25f4c41ed671e3007febc6de2f62a7172915472 /test/system | |
parent | 85d3641fe1bd1be93e6461e823d8ad749cb2ccc2 (diff) | |
parent | 03d32d05ac15c7b542d8761d8a7839865f362386 (diff) | |
download | podman-d6bf6b92c8aba3195261e3bedd1d4f11a7210314.tar.gz podman-d6bf6b92c8aba3195261e3bedd1d4f11a7210314.tar.bz2 podman-d6bf6b92c8aba3195261e3bedd1d4f11a7210314.zip |
Merge pull request #6456 from edsantiago/bats
system tests : more tests
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/075-exec.bats | 15 | ||||
-rw-r--r-- | test/system/200-pod.bats | 32 | ||||
-rw-r--r-- | test/system/500-networking.bats | 23 |
3 files changed, 61 insertions, 9 deletions
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats index 36e9d57ec..f8c7f2766 100644 --- a/test/system/075-exec.bats +++ b/test/system/075-exec.bats @@ -50,6 +50,7 @@ load helpers } # Issue #4785 - piping to exec statement - fixed in #4818 +# Issue #5046 - piping to exec truncates results (actually a conmon issue) @test "podman exec - cat from stdin" { skip_if_remote @@ -60,6 +61,20 @@ load helpers run_podman exec -i $cid cat < <(echo $echo_string) is "$output" "$echo_string" "output read back from 'exec cat'" + # #5046 - large file content gets lost via exec + # Generate a large file with random content; get a hash of its content + local bigfile=${PODMAN_TMPDIR}/bigfile + dd if=/dev/urandom of=$bigfile bs=1024 count=1500 + expect=$(sha512sum $bigfile | awk '{print $1}') + # Transfer it to container, via exec, make sure correct #bytes are sent + run_podman exec -i $cid dd of=/tmp/bigfile bs=512 <$bigfile + is "${lines[0]}" "3000+0 records in" "dd: number of records in" + is "${lines[1]}" "3000+0 records out" "dd: number of records out" + # Verify sha. '% *' strips off the path, keeping only the SHA + run_podman exec $cid sha512sum /tmp/bigfile + is "${output% *}" "$expect" "SHA of file in container" + + # Clean up run_podman exec $cid touch /stop run_podman wait $cid run_podman rm $cid diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index f34cd0707..0d14ca990 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -56,7 +56,11 @@ function teardown() { skip_if_remote "podman-pod does not work with podman-remote" podname=pod$(random_string) + run_podman 1 pod exists $podname run_podman pod create --infra=true --name=$podname + podid="$output" + run_podman pod exists $podname + run_podman pod exists $podid # Randomly-assigned port in the 5xxx range for port in $(shuf -i 5000-5999);do @@ -91,6 +95,10 @@ function teardown() { # ...then rm the pod, then rmi the pause image so we don't leave strays. run_podman pod rm $podname run_podman rmi $pause_iid + + # Pod no longer exists + run_podman 1 pod exists $podid + run_podman 1 pod exists $podname } # Random byte @@ -131,6 +139,9 @@ function random_ip() { hostname=$(random_string | tr A-Z a-z).$(random_string | tr A-Z a-z).net + labelname=$(random_string 11) + labelvalue=$(random_string 22) + pod_id_file=${PODMAN_TMPDIR}/pod-id-file # Create a pod with all the desired options @@ -143,7 +154,8 @@ function random_ip() { --add-host "$add_host_n:$add_host_ip" \ --dns "$dns_server" \ --dns-search "$dns_search" \ - --dns-opt "$dns_opt" + --dns-opt "$dns_opt" \ + --label "${labelname}=${labelvalue}" pod_id="$output" # Check --pod-id-file @@ -168,18 +180,20 @@ function random_ip() { is "$output" ".*nameserver $dns_server" "--dns [server] was added" is "$output" ".*search $dns_search" "--dns-search was added" is "$output" ".*options $dns_opt" "--dns-opt was added" -} -@test "podman pod inspect - format" { - skip_if_remote "podman-pod does not work with podman-remote" + # pod inspect + run_podman pod inspect --format '{{.Name}}: {{.ID}} : {{.NumContainers}} : {{.Labels}}' mypod + is "$output" "mypod: $pod_id : 1 : map\[${labelname}:${labelvalue}]" \ + "pod inspect --format ..." - run_podman pod create --name podtest - podid=$output + # pod ps + run_podman pod ps --format '{{.ID}} {{.Name}} {{.Status}} {{.Labels}}' + is "$output" "${pod_id:0:12} mypod Running map\[${labelname}:${labelvalue}]" "pod ps" - run_podman pod inspect --format '-> {{.Name}}: {{.NumContainers}}' podtest - is "$output" "-> podtest: 1" + run_podman pod ps --no-trunc --filter "label=${labelname}=${labelvalue}" --format '{{.ID}}' + is "$output" "$pod_id" "pod ps --filter label=..." - run_podman pod rm -f podtest + run_podman pod rm -f mypod } # vim: filetype=sh diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats index cd836610b..c9d1984d0 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -60,4 +60,27 @@ load helpers run_podman rmi busybox } +# Issue #5466 - port-forwarding doesn't work with this option and -d +@test "podman networking: port with --userns=keep-id" { + skip_if_remote + + # FIXME: randomize port, and create second random host port + myport=54321 + + # Container will exit as soon as 'nc' receives input + run_podman run -d --userns=keep-id -p 127.0.0.1:$myport:$myport \ + $IMAGE nc -l -p $myport + cid="$output" + + # emit random string, and check it + teststring=$(random_string 30) + echo "$teststring" | nc 127.0.0.1 $myport + + run_podman logs $cid + is "$output" "$teststring" "test string received on container" + + # Clean up + run_podman rm $cid +} + # vim: filetype=sh |