rev: AsyncResponse => DeferredResponse API cleanup
[rainbows.git] / t / lib-input-trailer.sh
blob758da4e4fbba761f53e7a2b029e269059342099c
1 . ./test-lib.sh
2 test -r random_blob || die "random_blob required, run with 'make $0'"
3 echo "input trailer test model=$model"
5 eval $(unused_listen)
6 rtmpfiles unicorn_config tmp r_err r_out pid fifo ok
8 cat > $unicorn_config <<EOF
9 listen "$listen"
10 pid "$pid"
11 stderr_path "$r_err"
12 stdout_path "$r_out"
13 Rainbows! { use :$model }
14 EOF
16 rainbows -D content-md5.ru -c $unicorn_config
17 wait_for_pid $pid
19 echo "small blob"
21 echo hello world | content-md5-put
22 cat $fifo > $tmp &
23 wait
24 echo ok > $ok
25 ) | socat - TCP:$listen | utee $fifo
27 fgrep 'HTTP/1.1 200 OK' $tmp
28 test xok = x"$(cat $ok)"
29 check_stderr
31 echo "big blob"
33 content-md5-put < random_blob
34 cat $fifo > $tmp &
35 wait
36 echo ok > $ok
37 ) | socat - TCP:$listen | utee $fifo
39 fgrep 'HTTP/1.1 200 OK' $tmp
40 test xok = x"$(cat $ok)"
41 check_stderr
43 echo "staggered blob"
46 dd bs=164 count=1 < random_blob
47 sleep 2
48 dd bs=4545 count=1 < random_blob
49 sleep 2
50 dd bs=1234 count=1 < random_blob
51 echo ok > $ok
52 ) 2>/dev/null | content-md5-put
53 test xok = x"$(cat $ok)"
54 cat $fifo > $tmp &
55 wait
56 echo ok > $ok
57 ) | socat - TCP:$listen | utee $fifo
59 fgrep 'HTTP/1.1 200 OK' $tmp
60 test xok = x"$(cat $ok)"
61 check_stderr
63 kill $(cat $pid)