File: smoke-test

package info (click to toggle)
ruby-sinatra 4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,932 kB
  • sloc: ruby: 17,700; sh: 25; makefile: 8
file content (33 lines) | stat: -rwxr-xr-x 456 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

set -eu

cd "${AUTOPKGTEST_TMP:-/tmp}"

cat > app.rb <<EOF
require "sinatra"
get "/" do
  "HELLO"
end
EOF

ruby app.rb -p 9999 &
pid=$!

trap "kill $pid && wait" INT TERM EXIT

tries=0
while [ $tries -lt 10 ]; do
  sleep 1
  set -x
  if curl --silent --fail -o output http://localhost:9999/; then
    if grep HELLO output; then
      exit 0
    fi
  fi
  set +x
  tries=$((tries + 1))
done

echo "Timeout out waiting for expected output"
exit 1