summaryrefslogtreecommitdiff
path: root/test/system/200-pod.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-05-28 13:43:59 -0600
committerEd Santiago <santiago@redhat.com>2020-06-01 12:00:47 -0600
commit03d32d05ac15c7b542d8761d8a7839865f362386 (patch)
tree0e2251c8cb31a0d91a9888bf8a1c20ec1181e171 /test/system/200-pod.bats
parent5f1c23dba9f6e02ed2551aabda371d007e9057e2 (diff)
downloadpodman-03d32d05ac15c7b542d8761d8a7839865f362386.tar.gz
podman-03d32d05ac15c7b542d8761d8a7839865f362386.tar.bz2
podman-03d32d05ac15c7b542d8761d8a7839865f362386.zip
system tests : more tests
- exec: add test for #5046, in which conmon swallowed chars on a large byte transfer - pod: add 'pod exists' tests, both positive and negative; consolidate tests; add '--label', and check in 'pod inspect' add 'pod ps' tests - networking: add test for #5466, in which detached run with --userns=keep-id would not forward a port Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/200-pod.bats')
-rw-r--r--test/system/200-pod.bats32
1 files changed, 23 insertions, 9 deletions
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