Look up the container's name for kpod-stop-by-name

In the kpod-stop-by-name test, use 'kpod inspect' to look up the name of
the container, rather than predicting the name that crio will assign.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-10-10 17:51:28 -04:00
parent 436194290a
commit a88f6840d8
2 changed files with 9 additions and 2 deletions

View file

@ -108,4 +108,4 @@
- name: Update the kernel cmdline to include quota support - name: Update the kernel cmdline to include quota support
command: grubby --update-kernel=ALL --args="rootflags=pquota" command: grubby --update-kernel=ALL --args="rootflags=pquota"
when: ansible_distribution in ['RedHat', 'CentOS'] when: ansible_distribution in ['RedHat', 'CentOS']

View file

@ -41,8 +41,15 @@ function teardown() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
ctr_id="$output" ctr_id="$output"
run crioctl ctr start --id "$ctr_id" run crioctl ctr start --id "$ctr_id"
[ "$status" -eq 0 ]
run crioctl ctr inspect --id "$ctr_id"
echo "$output" echo "$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" [ "$status" -eq 0 ]
ctr_name=$(python -c 'import json; import sys; print json.load(sys.stdin)["crio_annotations"]["io.kubernetes.cri-o.Name"]' <<< "$output")
echo container name is \""$ctr_name"\"
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_name"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods cleanup_pods
stop_crio stop_crio
} }