rainbows 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. data/GIT-VERSION-GEN +1 -1
  2. data/GNUmakefile +12 -6
  3. data/README +3 -2
  4. data/Rakefile +3 -3
  5. data/TODO +2 -9
  6. data/lib/rainbows.rb +1 -0
  7. data/lib/rainbows/app_pool.rb +10 -6
  8. data/lib/rainbows/base.rb +1 -1
  9. data/lib/rainbows/const.rb +1 -1
  10. data/lib/rainbows/ev_core.rb +88 -0
  11. data/lib/rainbows/event_machine.rb +218 -0
  12. data/lib/rainbows/http_server.rb +4 -1
  13. data/lib/rainbows/rev.rb +21 -89
  14. data/lib/rainbows/revactor.rb +4 -10
  15. data/local.mk.sample +13 -7
  16. data/rainbows.gemspec +17 -2
  17. data/t/.gitignore +1 -0
  18. data/t/GNUmakefile +63 -40
  19. data/t/README +6 -2
  20. data/t/async_sinatra.ru +13 -0
  21. data/t/bin/unused_listen +1 -1
  22. data/t/large-file-response.ru +1 -0
  23. data/t/my-tap-lib.sh +200 -0
  24. data/t/simple-http_Base.ru +3 -0
  25. data/t/simple-http_EventMachine.ru +9 -0
  26. data/t/simple-http_Rev.ru +9 -0
  27. data/t/simple-http_Revactor.ru +10 -0
  28. data/t/simple-http_ThreadPool.ru +10 -0
  29. data/t/simple-http_ThreadSpawn.ru +10 -0
  30. data/t/t0000-simple-http.sh +142 -0
  31. data/t/t0001-unix-http.sh +103 -0
  32. data/t/t0002-graceful.sh +32 -0
  33. data/t/t0002-parser-error.sh +31 -0
  34. data/t/t0003-reopen-logs.sh +97 -0
  35. data/t/t0005-large-file-response.sh +83 -0
  36. data/t/t0100-rack-input-hammer.sh +45 -0
  37. data/t/t0101-rack-input-trailer.sh +68 -0
  38. data/t/t0200-async-response.sh +66 -0
  39. data/t/t0201-async-response-no-autochunk.sh +3 -0
  40. data/t/t0300-async_sinatra.sh +65 -0
  41. data/t/t9000-rack-app-pool.sh +45 -33
  42. data/t/test-lib.sh +67 -56
  43. metadata +26 -56
  44. data/t/lib-async-response-no-autochunk.sh +0 -6
  45. data/t/lib-async-response.sh +0 -45
  46. data/t/lib-graceful.sh +0 -40
  47. data/t/lib-input-trailer.sh +0 -63
  48. data/t/lib-large-file-response.sh +0 -45
  49. data/t/lib-parser-error.sh +0 -29
  50. data/t/lib-rack-input-hammer.sh +0 -38
  51. data/t/lib-reopen-logs.sh +0 -60
  52. data/t/lib-simple-http.sh +0 -92
  53. data/t/t0000-basic.sh +0 -2
  54. data/t/t1000-thread-pool-basic.sh +0 -2
  55. data/t/t1002-thread-pool-graceful.sh +0 -2
  56. data/t/t1003-thread-pool-reopen-logs.sh +0 -2
  57. data/t/t1004-thread-pool-async-response.sh +0 -45
  58. data/t/t1005-thread-pool-large-file-response.sh +0 -45
  59. data/t/t1006-thread-pool-async-response-no-autochunk.sh +0 -6
  60. data/t/t1100-thread-pool-rack-input.sh +0 -2
  61. data/t/t1101-thread-pool-input-trailer.sh +0 -2
  62. data/t/t2000-thread-spawn-basic.sh +0 -2
  63. data/t/t2002-thread-spawn-graceful.sh +0 -2
  64. data/t/t2003-thread-spawn-reopen-logs.sh +0 -2
  65. data/t/t2004-thread-spawn-async-response.sh +0 -45
  66. data/t/t2005-thread-spawn-large-file-response.sh +0 -45
  67. data/t/t2006-thread-spawn-async-response-no-autochunk.sh +0 -6
  68. data/t/t2100-thread-spawn-rack-input.sh +0 -2
  69. data/t/t2101-thread-spawn-input-trailer.sh +0 -2
  70. data/t/t3000-revactor-basic.sh +0 -2
  71. data/t/t3002-revactor-graceful.sh +0 -2
  72. data/t/t3003-revactor-reopen-logs.sh +0 -2
  73. data/t/t3004-revactor-async-response.sh +0 -45
  74. data/t/t3005-revactor-large-file-response.sh +0 -2
  75. data/t/t3006-revactor-async-response-no-autochunk.sh +0 -6
  76. data/t/t3100-revactor-rack-input.sh +0 -2
  77. data/t/t3101-revactor-rack-input-trailer.sh +0 -2
  78. data/t/t4000-rev-basic.sh +0 -2
  79. data/t/t4002-rev-graceful.sh +0 -2
  80. data/t/t4003-rev-parser-error.sh +0 -2
  81. data/t/t4003-rev-reopen-logs.sh +0 -2
  82. data/t/t4004-rev-async-response.sh +0 -45
  83. data/t/t4005-rev-large-file-response.sh +0 -2
  84. data/t/t4006-rev-async-response-no-autochunk.sh +0 -6
  85. data/t/t4100-rev-rack-input.sh +0 -2
  86. data/t/t4101-rev-rack-input-trailer.sh +0 -2
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-rack-input-hammer.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-input-trailer.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-simple-http.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-graceful.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-reopen-logs.sh
@@ -1,45 +0,0 @@
1
- CONFIG_RU=${CONFIG_RU-'async-response.ru'}
2
- . ./test-lib.sh
3
- echo "async response for model=$model"
4
- eval $(unused_listen)
5
- rtmpfiles unicorn_config a b c r_err r_out pid curl_err
6
-
7
- cat > $unicorn_config <<EOF
8
- listen "$listen"
9
- stderr_path "$r_err"
10
- stdout_path "$r_out"
11
- pid "$pid"
12
- Rainbows! { use :$model }
13
- EOF
14
-
15
- # can't load Rack::Lint here since it'll cause Rev to slurp
16
- rainbows -E none -D $CONFIG_RU -c $unicorn_config
17
- wait_for_pid $pid
18
-
19
- t0=$(date +%s)
20
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
21
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
22
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
23
- wait
24
- t1=$(date +%s)
25
-
26
- rainbows_pid=$(cat $pid)
27
- kill -QUIT $rainbows_pid
28
- elapsed=$(( $t1 - $t0 ))
29
- echo "elapsed=$elapsed < 30"
30
- test $elapsed -lt 30
31
-
32
- dbgcat a
33
- dbgcat b
34
- dbgcat c
35
- dbgcat r_err
36
- dbgcat curl_err
37
- test ! -s $curl_err
38
- check_stderr
39
-
40
- while kill -0 $rainbows_pid >/dev/null 2>&1
41
- do
42
- sleep 1
43
- done
44
-
45
- dbgcat r_err
@@ -1,45 +0,0 @@
1
- . ./test-lib.sh
2
- test -r random_blob || die "random_blob required, run with 'make $0'"
3
- if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1
4
- then
5
- echo >&2 "skipping, can't read RSS from /proc/self/status"
6
- exit 0
7
- fi
8
- echo "large file response slurp avoidance for model=$model"
9
- eval $(unused_listen)
10
- rtmpfiles unicorn_config tmp r_err r_out pid ok
11
-
12
- cat > $unicorn_config <<EOF
13
- listen "$listen"
14
- stderr_path "$r_err"
15
- stdout_path "$r_out"
16
- pid "$pid"
17
- Rainbows! { use :$model }
18
- EOF
19
-
20
- # can't load Rack::Lint here since it'll cause Rev to slurp
21
- rainbows -E none -D large-file-response.ru -c $unicorn_config
22
- wait_for_pid $pid
23
-
24
- random_blob_size=$(wc -c < random_blob)
25
- curl -v http://$listen/rss
26
- dbgcat r_err
27
- rss_before=$(curl -sSfv http://$listen/rss)
28
- echo "rss_before=$rss_before"
29
-
30
- for i in a b c
31
- do
32
- size=$( (curl -sSfv http://$listen/random_blob && echo ok > $ok) | wc -c)
33
- test $size -eq $random_blob_size
34
- test xok = x$(cat $ok)
35
- done
36
-
37
- dbgcat r_err
38
- curl -v http://$listen/rss
39
- rss_after=$(curl -sSfv http://$listen/rss)
40
- echo "rss_after=$rss_after"
41
- diff=$(( $rss_after - $rss_before ))
42
- echo "test diff=$diff < orig=$random_blob_size"
43
- kill -QUIT $(cat $pid)
44
- test $diff -le $random_blob_size
45
- dbgcat r_err
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
- CONFIG_RU=async-response-no-autochunk.ru
3
- . ./lib-async-response.sh
4
- test x"$(cat $a)" = x0123456789
5
- test x"$(cat $b)" = x0123456789
6
- test x"$(cat $c)" = x0123456789
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-rack-input-hammer.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-input-trailer.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-simple-http.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-graceful.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-reopen-logs.sh
@@ -1,45 +0,0 @@
1
- CONFIG_RU=${CONFIG_RU-'async-response.ru'}
2
- . ./test-lib.sh
3
- echo "async response for model=$model"
4
- eval $(unused_listen)
5
- rtmpfiles unicorn_config a b c r_err r_out pid curl_err
6
-
7
- cat > $unicorn_config <<EOF
8
- listen "$listen"
9
- stderr_path "$r_err"
10
- stdout_path "$r_out"
11
- pid "$pid"
12
- Rainbows! { use :$model }
13
- EOF
14
-
15
- # can't load Rack::Lint here since it'll cause Rev to slurp
16
- rainbows -E none -D $CONFIG_RU -c $unicorn_config
17
- wait_for_pid $pid
18
-
19
- t0=$(date +%s)
20
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
21
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
22
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
23
- wait
24
- t1=$(date +%s)
25
-
26
- rainbows_pid=$(cat $pid)
27
- kill -QUIT $rainbows_pid
28
- elapsed=$(( $t1 - $t0 ))
29
- echo "elapsed=$elapsed < 30"
30
- test $elapsed -lt 30
31
-
32
- dbgcat a
33
- dbgcat b
34
- dbgcat c
35
- dbgcat r_err
36
- dbgcat curl_err
37
- test ! -s $curl_err
38
- check_stderr
39
-
40
- while kill -0 $rainbows_pid >/dev/null 2>&1
41
- do
42
- sleep 1
43
- done
44
-
45
- dbgcat r_err
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-large-file-response.sh
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
- CONFIG_RU=async-response-no-autochunk.ru
3
- . ./lib-async-response.sh
4
- test x"$(cat $a)" = x0123456789
5
- test x"$(cat $b)" = x0123456789
6
- test x"$(cat $c)" = x0123456789
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-rack-input-hammer.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-input-trailer.sh
data/t/t4000-rev-basic.sh DELETED
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-simple-http.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-graceful.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-parser-error.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-reopen-logs.sh
@@ -1,45 +0,0 @@
1
- CONFIG_RU=${CONFIG_RU-'async-response.ru'}
2
- . ./test-lib.sh
3
- echo "async response for model=$model"
4
- eval $(unused_listen)
5
- rtmpfiles unicorn_config a b c r_err r_out pid curl_err
6
-
7
- cat > $unicorn_config <<EOF
8
- listen "$listen"
9
- stderr_path "$r_err"
10
- stdout_path "$r_out"
11
- pid "$pid"
12
- Rainbows! { use :$model }
13
- EOF
14
-
15
- # can't load Rack::Lint here since it'll cause Rev to slurp
16
- rainbows -E none -D $CONFIG_RU -c $unicorn_config
17
- wait_for_pid $pid
18
-
19
- t0=$(date +%s)
20
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
21
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
22
- ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
23
- wait
24
- t1=$(date +%s)
25
-
26
- rainbows_pid=$(cat $pid)
27
- kill -QUIT $rainbows_pid
28
- elapsed=$(( $t1 - $t0 ))
29
- echo "elapsed=$elapsed < 30"
30
- test $elapsed -lt 30
31
-
32
- dbgcat a
33
- dbgcat b
34
- dbgcat c
35
- dbgcat r_err
36
- dbgcat curl_err
37
- test ! -s $curl_err
38
- check_stderr
39
-
40
- while kill -0 $rainbows_pid >/dev/null 2>&1
41
- do
42
- sleep 1
43
- done
44
-
45
- dbgcat r_err
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-large-file-response.sh
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
- CONFIG_RU=async-response-no-autochunk.ru
3
- . ./lib-async-response.sh
4
- test x"$(cat $a)" = x0123456789
5
- test x"$(cat $b)" = x0123456789
6
- test x"$(cat $c)" = x0123456789
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-rack-input-hammer.sh
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- . ./lib-input-trailer.sh