github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/apiv2/26-containersWait.at (about) 1 # -*- sh -*- 2 # 3 # test more container-related endpoints 4 # 5 6 red='\e[31m' 7 nc='\e[0m' 8 9 podman pull "${IMAGE}" &>/dev/null 10 11 # Ensure clean slate 12 podman rm -a -f &>/dev/null 13 14 CTR="WaitTestingCtr" 15 16 t POST "containers/nonExistent/wait?condition=next-exit" 404 17 18 podman create --name "${CTR}" --entrypoint '["true"]' "${IMAGE}" 19 20 t POST "containers/${CTR}/wait?condition=non-existent-cond" 400 21 22 t POST "containers/${CTR}/wait?condition=not-running" 200 23 24 t POST "containers/${CTR}/wait?condition=next-exit" 200 \ 25 .StatusCode=0 \ 26 .Error=null & 27 child_pid=$! 28 podman start "${CTR}" 29 wait "${child_pid}" 30 31 32 # check if headers are sent in advance before body 33 WAIT_TEST_ERROR="" 34 curl -I -X POST "http://$HOST:$PORT/containers/${CTR}/wait?condition=next-exit" &> "/dev/null" & 35 child_pid=$! 36 sleep 0.5 37 if kill -2 "${child_pid}" 2> "/dev/null"; then 38 echo -e "${red}NOK: Failed to get response headers immediately.${nc}" 1>&2; 39 WAIT_TEST_ERROR="1" 40 fi 41 42 t POST "containers/${CTR}/wait?condition=removed" 200 & 43 child_pid=$! 44 podman container rm "${CTR}" 45 wait "${child_pid}" 46 47 if [[ "${WAIT_TEST_ERROR}" ]] ; then 48 exit 1; 49 fi