rainbows 0.5.0 → 0.6.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.
@@ -2,6 +2,11 @@ nr_client=${nr_client-4}
2
2
  . ./test-lib.sh
3
3
  test -r random_blob || die "random_blob required, run with 'make $0'"
4
4
 
5
+ # basically we don't trust our own implementation of content-md5-put
6
+ # nor our Ruby 1.9 knowledge nor proper use of encodings in Ruby.
7
+ # So we try to use things like curl and sha1sum that are implemented
8
+ # without the Ruby interpreter to validate our own Ruby internals.
9
+
5
10
  t_plan 7 "concurrent rack.input hammer stress test"
6
11
 
7
12
  t_begin "setup and startup" && {
@@ -35,7 +40,7 @@ t_begin "all responses identical" && {
35
40
  }
36
41
 
37
42
  t_begin "sha1 matches on-disk sha1" && {
38
- blob_sha1=$( expr "$(sha1sum < random_blob)" : '\([a-f0-9]\{40\}\)')
43
+ blob_sha1=$(rsha1 < random_blob)
39
44
  t_info blob_sha1=$blob_sha1
40
45
  test x"$blob_sha1" = x"$(sort < $curl_out | uniq)"
41
46
  }
@@ -0,0 +1,32 @@
1
+ #!/bin/sh
2
+ . ./test-lib.sh
3
+ test -r random_blob || die "random_blob required, run with 'make $0'"
4
+
5
+ t_plan 4 "rack.input short read tests"
6
+
7
+ t_begin "setup and startup" && {
8
+ rtmpfiles curl_out curl_err
9
+ rainbows_setup $model
10
+ rainbows -D sha1-random-size.ru -c $unicorn_config
11
+ blob_sha1=$(rsha1 random_blob)
12
+ t_info "blob_sha1=$blob_sha1"
13
+ rainbows_wait_start
14
+ }
15
+
16
+ t_begin "regular request" && {
17
+ curl -sSf -T random_blob http://$listen/ > $curl_out 2> $curl_err
18
+ test x$blob_sha1 = x$(cat $curl_out)
19
+ test ! -s $curl_err
20
+ }
21
+
22
+ t_begin "chunked request" && {
23
+ curl -sSf -T- < random_blob http://$listen/ > $curl_out 2> $curl_err
24
+ test x$blob_sha1 = x$(cat $curl_out)
25
+ test ! -s $curl_err
26
+ }
27
+
28
+ t_begin "shutdown" && {
29
+ kill $rainbows_pid
30
+ }
31
+
32
+ t_done
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  . ./test-lib.sh
3
3
  case $model in
4
- Thread*) ;;
4
+ *Thread*) ;;
5
5
  *)
6
6
  t_info "skipping $T since it's not compatible with $model"
7
7
  exit 0
data/t/test-lib.sh CHANGED
@@ -110,7 +110,7 @@ before_fork do |server, worker|
110
110
  # so notify the script on the first worker we spawn
111
111
  # by opening the FIFO
112
112
  if worker.nr == 0
113
- File.open("$fifo", "wb").close
113
+ File.open("$fifo", "wb") { |fp| fp.syswrite "START" }
114
114
  end
115
115
  end
116
116
  EOF
@@ -130,10 +130,20 @@ EOF
130
130
  rainbows_wait_start () {
131
131
  # "cat $fifo" will block until the before_fork hook is called in
132
132
  # the Unicorn config file
133
- test x = x"$(cat $fifo)"
133
+ test xSTART = x"$(cat $fifo)"
134
134
  rainbows_pid=$(cat $pid)
135
135
  }
136
136
 
137
+ rsha1 () {
138
+ _cmd="$(which sha1sum 2>/dev/null || :)"
139
+ test -n "$_cmd" || _cmd="$(which openssl 2>/dev/null || :) sha1"
140
+ test "$_cmd" != " sha1" || _cmd="$(which gsha1sum 2>/dev/null || :)"
141
+
142
+ # last resort, see comments in sha1sum.rb for reasoning
143
+ test -n "$_cmd" || _cmd=sha1sum.rb
144
+ expr "$($_cmd < random_blob)" : '\([a-f0-9]\{40\}\)'
145
+ }
146
+
137
147
  case $model in
138
148
  Rev) require_check rev Rev::VERSION ;;
139
149
  Revactor) require_check revactor Revactor::VERSION ;;
@@ -0,0 +1,17 @@
1
+ use Rack::ContentLength
2
+ headers = { 'Content-Type' => 'text/plain' }
3
+ run lambda { |env|
4
+ /\A100-continue\z/i =~ env['HTTP_EXPECT'] and return [ 100, {}, [] ]
5
+ env['rack.input'].read
6
+
7
+ case env["PATH_INFO"]
8
+ when %r{/sleep/(\d+)}
9
+ (case env['rainbows.model']
10
+ when :Revactor
11
+ Actor
12
+ else
13
+ Kernel
14
+ end).sleep($1.to_i)
15
+ end
16
+ [ 200, headers, [ "#$$\n" ] ]
17
+ }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainbows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
- - Rainbows! developers
7
+ - Rainbows! hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-05 00:00:00 -08:00
12
+ date: 2009-11-15 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 0.94.0
23
+ version: 0.95.0
24
24
  version:
25
25
  description: |-
26
26
  Rainbows! is a HTTP server for sleepy Rack applications. It is based on
@@ -43,11 +43,16 @@ extra_rdoc_files:
43
43
  - lib/rainbows/const.rb
44
44
  - lib/rainbows/dev_fd_response.rb
45
45
  - lib/rainbows/ev_core.rb
46
+ - lib/rainbows/ev_thread_core.rb
46
47
  - lib/rainbows/event_machine.rb
47
48
  - lib/rainbows/http_response.rb
48
49
  - lib/rainbows/http_server.rb
49
50
  - lib/rainbows/rev.rb
51
+ - lib/rainbows/rev/client.rb
52
+ - lib/rainbows/rev/core.rb
53
+ - lib/rainbows/rev/deferred_response.rb
50
54
  - lib/rainbows/rev/heartbeat.rb
55
+ - lib/rainbows/rev_thread_spawn.rb
51
56
  - lib/rainbows/revactor.rb
52
57
  - lib/rainbows/revactor/tee_input.rb
53
58
  - lib/rainbows/thread_pool.rb
@@ -87,11 +92,16 @@ files:
87
92
  - lib/rainbows/const.rb
88
93
  - lib/rainbows/dev_fd_response.rb
89
94
  - lib/rainbows/ev_core.rb
95
+ - lib/rainbows/ev_thread_core.rb
90
96
  - lib/rainbows/event_machine.rb
91
97
  - lib/rainbows/http_response.rb
92
98
  - lib/rainbows/http_server.rb
93
99
  - lib/rainbows/rev.rb
100
+ - lib/rainbows/rev/client.rb
101
+ - lib/rainbows/rev/core.rb
102
+ - lib/rainbows/rev/deferred_response.rb
94
103
  - lib/rainbows/rev/heartbeat.rb
104
+ - lib/rainbows/rev_thread_spawn.rb
95
105
  - lib/rainbows/revactor.rb
96
106
  - lib/rainbows/revactor/tee_input.rb
97
107
  - lib/rainbows/thread_pool.rb
@@ -107,6 +117,7 @@ files:
107
117
  - t/async-response.ru
108
118
  - t/async_sinatra.ru
109
119
  - t/bin/content-md5-put
120
+ - t/bin/sha1sum.rb
110
121
  - t/bin/unused_listen
111
122
  - t/bin/utee
112
123
  - t/content-md5.ru
@@ -115,10 +126,12 @@ files:
115
126
  - t/heartbeat-timeout.ru
116
127
  - t/large-file-response.ru
117
128
  - t/my-tap-lib.sh
129
+ - t/sha1-random-size.ru
118
130
  - t/sha1.ru
119
131
  - t/simple-http_Base.ru
120
132
  - t/simple-http_EventMachine.ru
121
133
  - t/simple-http_Rev.ru
134
+ - t/simple-http_RevThreadSpawn.ru
122
135
  - t/simple-http_Revactor.ru
123
136
  - t/simple-http_ThreadPool.ru
124
137
  - t/simple-http_ThreadSpawn.ru
@@ -132,14 +145,18 @@ files:
132
145
  - t/t0004-heartbeat-timeout.sh
133
146
  - t/t0005-large-file-response.sh
134
147
  - t/t0006-process-rack-env.sh
148
+ - t/t0007-worker-follows-master-to-death.sh
149
+ - t/t0008-ensure-usable-after-limit.sh
135
150
  - t/t0100-rack-input-hammer.sh
136
151
  - t/t0101-rack-input-trailer.sh
152
+ - t/t0102-rack-input-short.sh
137
153
  - t/t0200-async-response.sh
138
154
  - t/t0201-async-response-no-autochunk.sh
139
155
  - t/t0300-async_sinatra.sh
140
156
  - t/t9000-rack-app-pool.sh
141
157
  - t/t9000.ru
142
158
  - t/test-lib.sh
159
+ - t/worker-follows-master-to-death.ru
143
160
  - vs_Unicorn
144
161
  has_rdoc: true
145
162
  homepage: http://rainbows.rubyforge.org/