github.com/AbhinandanKurakure/podman/v3@v3.4.10/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 t HEAD /libpod/_ping 200 12 13 t GET _ping 200 OK 14 t HEAD _ping 200 15 t GET libpod/_ping 200 OK 16 t HEAD libpod/_ping 200 17 18 for i in /version version; do 19 t GET $i 200 \ 20 .Components[0].Name="Podman Engine" \ 21 .Components[0].Details.APIVersion~3[0-9.-]\\+ \ 22 .Components[0].Details.MinAPIVersion=3.1.0 \ 23 .Components[0].Details.Os=linux \ 24 .ApiVersion=1.40 \ 25 .MinAPIVersion=1.24 \ 26 .Os=linux 27 done 28 29 # 30 # Garbage tests - requests that should yield errors 31 # 32 t GET /nonesuch 404 33 t POST /nonesuch 404 34 t GET container/nonesuch/json 404 35 t GET libpod/containers/nonesuch/json 404 36 37 #### FIXME: maybe someday: t GET 'libpod/containers/json?a=b' 400 38 39 # Method not allowed 40 t POST /_ping 405 41 t DELETE /_ping 405 42 t POST libpod/containers/json 405 43 t POST libpod/pods/abc 405 44 t POST info 405 45 t GET libpod/containers/create 405 46 47 # 48 # system info 49 # 50 # Some day perhaps it will always be runc; for now, cgroupsv2 requires crun 51 # 52 # FIXME: run 'podman info --format=json', and compare select fields 53 runtime=runc 54 if have_cgroupsv2; then 55 runtime=crun 56 fi 57 t GET info 200 \ 58 .OSType=linux \ 59 .DefaultRuntime~.*$runtime \ 60 .MemTotal~[0-9]\\+ 61 62 # Timing: make sure server stays responsive. 63 # Because /info may need to check storage, it may be slow the first time. 64 # Let's invoke it once to prime caches, then run ten queries in a timed loop. 65 t GET info 200 66 t0=$SECONDS 67 for i in $(seq 1 10); do 68 # FIXME: someday: refactor t(), separate out the 'curl' logic so we 69 # can call it directly. Then we won't get ten annoying 'ok' lines. 70 t GET info 200 71 done 72 t1=$SECONDS 73 delta_t=$((t1 - t2)) 74 75 # Desired number of seconds in which we expect to run. 76 # FIXME: 10 seconds is a lot! PR #8076 opened to investigate why. 77 want=10 78 if [ $delta_t -le $want ]; then 79 _show_ok 1 "Time for ten /info requests ($delta_t seconds) <= ${want}s" 80 else 81 _show_ok 0 "Time for ten /info requests" "<= $want seconds" "$delta_t seconds" 82 fi 83 84 # Simple events test (see #7078) 85 t GET "events?stream=false" 200 86 t GET "libpod/events?stream=false" 200 87 88 # vim: filetype=sh