github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/apiv2/01-basic.at (about) 1 # -*- sh -*- 2 # 3 # The earliest most basic tests. If any of these fail, life is bad 4 # 5 6 # NOTE: paths with a leading slash will be interpreted as-is; 7 # paths without will have '/v1.40/' prepended. 8 t GET /_ping 200 OK 9 t HEAD /_ping 200 10 t GET /libpod/_ping 200 OK 11 12 for i in /version version; do 13 t GET $i 200 \ 14 .Components[0].Name="Podman Engine" \ 15 .Components[0].Details.APIVersion=1.40 \ 16 .Components[0].Details.MinAPIVersion=1.24 \ 17 .Components[0].Details.Os=linux \ 18 .ApiVersion=1.40 \ 19 .MinAPIVersion=1.24 \ 20 .Os=linux 21 done 22 23 # 24 # Garbage tests - requests that should yield errors 25 # 26 t GET /nonesuch 404 27 t POST /nonesuch '' 404 28 t GET container/nonesuch/json 404 29 t GET libpod/containers/nonesuch/json 404 30 31 #### FIXME: maybe someday: t GET 'libpod/containers/json?a=b' 400 32 33 # Method not allowed 34 t POST /_ping '' 405 35 t DELETE /_ping 405 36 t POST libpod/containers/json '' 405 37 t POST libpod/pods/abc '' 405 38 t POST info '' 405 39 t GET libpod/containers/create 405 40 41 # 42 # system info 43 # 44 # Some day perhaps it will always be runc; for now, cgroupsv2 requires crun 45 # 46 # FIXME: run 'podman info --format=json', and compare select fields 47 runtime=runc 48 if have_cgroupsv2; then 49 runtime=crun 50 fi 51 t GET info 200 \ 52 .OSType=linux \ 53 .DefaultRuntime~.*$runtime \ 54 .MemTotal~[0-9]\\+ 55 56 # Timing: make sure server stays responsive 57 t0=$SECONDS 58 for i in $(seq 1 10); do 59 # FIXME: someday: refactor t(), separate out the 'curl' logic so we 60 # can call it directly. Then we won't get ten annoying 'ok' lines. 61 t GET info 200 62 done 63 t1=$SECONDS 64 delta_t=$((t1 - t2)) 65 if [ $delta_t -le 5 ]; then 66 _show_ok 1 "Time for ten /info requests ($delta_t seconds) <= 5s" 67 else 68 _show_ok 0 "Time for ten /info requests" "<= 5 seconds" "$delta_t seconds" 69 fi 70 71 # vim: filetype=sh