rainbows 3.0.0 → 3.1.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 (77) hide show
  1. data/.wrongdoc.yml +2 -2
  2. data/Documentation/comparison.haml +6 -6
  3. data/GIT-VERSION-GEN +1 -1
  4. data/GNUmakefile +16 -128
  5. data/README +2 -3
  6. data/Rakefile +3 -3
  7. data/examples/reverse_proxy.ru +9 -0
  8. data/lib/rainbows.rb +14 -6
  9. data/lib/rainbows/base.rb +0 -1
  10. data/lib/rainbows/const.rb +1 -10
  11. data/lib/rainbows/coolio/client.rb +8 -4
  12. data/lib/rainbows/coolio/core.rb +0 -3
  13. data/lib/rainbows/coolio/thread_client.rb +2 -2
  14. data/lib/rainbows/coolio_fiber_spawn.rb +6 -6
  15. data/lib/rainbows/dev_fd_response.rb +16 -9
  16. data/lib/rainbows/epoll.rb +43 -0
  17. data/lib/rainbows/epoll/client.rb +232 -0
  18. data/lib/rainbows/epoll/response_chunk_pipe.rb +18 -0
  19. data/lib/rainbows/epoll/response_pipe.rb +32 -0
  20. data/lib/rainbows/epoll/server.rb +31 -0
  21. data/lib/rainbows/error.rb +1 -9
  22. data/lib/rainbows/ev_core.rb +12 -12
  23. data/lib/rainbows/ev_core/cap_input.rb +1 -1
  24. data/lib/rainbows/event_machine.rb +0 -6
  25. data/lib/rainbows/event_machine/client.rb +3 -3
  26. data/lib/rainbows/event_machine/response_chunk_pipe.rb +5 -7
  27. data/lib/rainbows/event_machine/response_pipe.rb +7 -8
  28. data/lib/rainbows/fiber/base.rb +2 -2
  29. data/lib/rainbows/fiber/io.rb +21 -63
  30. data/lib/rainbows/fiber/io/methods.rb +1 -1
  31. data/lib/rainbows/http_server.rb +4 -4
  32. data/lib/rainbows/join_threads.rb +18 -0
  33. data/lib/rainbows/max_body.rb +2 -1
  34. data/lib/rainbows/max_body/wrapper.rb +1 -1
  35. data/lib/rainbows/never_block/event_machine.rb +2 -2
  36. data/lib/rainbows/process_client.rb +9 -1
  37. data/lib/rainbows/queue_pool.rb +2 -2
  38. data/lib/rainbows/response.rb +1 -1
  39. data/lib/rainbows/rev_fiber_spawn.rb +4 -4
  40. data/lib/rainbows/revactor/client.rb +4 -5
  41. data/lib/rainbows/revactor/proxy.rb +1 -1
  42. data/lib/rainbows/reverse_proxy.rb +189 -0
  43. data/lib/rainbows/reverse_proxy/coolio.rb +61 -0
  44. data/lib/rainbows/reverse_proxy/ev_client.rb +39 -0
  45. data/lib/rainbows/reverse_proxy/event_machine.rb +46 -0
  46. data/lib/rainbows/reverse_proxy/multi_thread.rb +7 -0
  47. data/lib/rainbows/reverse_proxy/synchronous.rb +21 -0
  48. data/lib/rainbows/sendfile.rb +1 -1
  49. data/lib/rainbows/sync_close.rb +2 -2
  50. data/lib/rainbows/thread_pool.rb +1 -1
  51. data/lib/rainbows/writer_thread_pool.rb +1 -1
  52. data/lib/rainbows/xepoll.rb +24 -0
  53. data/lib/rainbows/xepoll/client.rb +45 -0
  54. data/pkg.mk +171 -0
  55. data/rainbows.gemspec +2 -4
  56. data/t/GNUmakefile +4 -0
  57. data/t/bin/content-md5-put +1 -0
  58. data/t/kgio-pipe-response.ru +9 -1
  59. data/t/rack-fiber_pool/app.ru +6 -1
  60. data/t/simple-http_Epoll.ru +9 -0
  61. data/t/simple-http_XEpoll.ru +9 -0
  62. data/t/t0014-config-conflict.sh +5 -3
  63. data/t/t0023-sendfile-byte-range.sh +1 -7
  64. data/t/t0034-pipelined-pipe-response.sh +2 -1
  65. data/t/t0035-kgio-pipe-response.sh +0 -7
  66. data/t/t0041-optional-pool-size.sh +51 -0
  67. data/t/t0050-response-body-close-has-env.sh +2 -1
  68. data/t/t0104-rack-input-limit-tiny.sh +6 -4
  69. data/t/t0105-rack-input-limit-bigger.sh +6 -4
  70. data/t/t0106-rack-input-keepalive.sh +2 -0
  71. data/t/t0107-rack-input-limit-zero.sh +60 -0
  72. data/t/t0113-rewindable-input-false.sh +1 -0
  73. data/t/t0114-rewindable-input-true.sh +1 -0
  74. data/t/t0202-async-response-one-oh.sh +56 -0
  75. data/t/test_isolate.rb +5 -2
  76. metadata +42 -37
  77. data/lib/rainbows/rack_input.rb +0 -17
@@ -35,7 +35,7 @@ module Rainbows::ThreadPool
35
35
  thr.join(1) and Rainbows.quit!
36
36
  end
37
37
  end
38
- join_threads(pool)
38
+ Rainbows::JoinThreads.acceptors(pool)
39
39
  end
40
40
 
41
41
  def sync_worker # :nodoc:
@@ -52,7 +52,7 @@ module Rainbows::WriterThreadPool
52
52
 
53
53
  @@q = qp.map { |q| q.queue }
54
54
  super(worker) # accept loop from Unicorn
55
- qp.map { |q| q.quit! }
55
+ qp.each { |q| q.quit! }
56
56
  end
57
57
  # :startdoc:
58
58
  end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: binary -*-
2
+ # :enddoc:
3
+ require 'raindrops'
4
+ require 'rainbows/epoll'
5
+
6
+ # Edge-triggered epoll concurrency model with blocking accept() in
7
+ # a (hopefully) native thread. This is recommended over Epoll for
8
+ # Ruby 1.9 users as it can workaround accept()-scalability issues
9
+ # on multicore machines.
10
+ module Rainbows::XEpoll
11
+ include Rainbows::Base
12
+ autoload :Client, 'rainbows/xepoll/client'
13
+
14
+ def init_worker_process(worker)
15
+ super
16
+ Rainbows::Epoll.const_set :EP, SleepyPenguin::Epoll.new
17
+ Rainbows::Client.__send__ :include, Client
18
+ end
19
+
20
+ def worker_loop(worker) # :nodoc:
21
+ init_worker_process(worker)
22
+ Client.run
23
+ end
24
+ end
@@ -0,0 +1,45 @@
1
+ # -*- encoding: binary -*-
2
+ # :enddoc:
3
+
4
+ module Rainbows::XEpoll::Client
5
+ N = Raindrops.new(1)
6
+ Rainbows::Epoll.nr_clients = lambda { N[0] }
7
+ include Rainbows::Epoll::Client
8
+ MAX = Rainbows.server.worker_connections
9
+ THRESH = MAX - 1
10
+ EP = Rainbows::Epoll::EP
11
+ THREADS = Rainbows::HttpServer::LISTENERS.map do |sock|
12
+ Thread.new(sock) do |sock|
13
+ sleep
14
+ begin
15
+ if io = sock.kgio_accept
16
+ N.incr(0, 1)
17
+ io.epoll_once
18
+ end
19
+ sleep while N[0] >= MAX
20
+ rescue => e
21
+ Rainbows::Error.listen_loop(e)
22
+ end while Rainbows.alive
23
+ end
24
+ end
25
+
26
+ def self.run
27
+ THREADS.each { |t| t.run }
28
+ Rainbows::Epoll.loop
29
+ Rainbows::JoinThreads.acceptors(THREADS)
30
+ end
31
+
32
+ # only call this once
33
+ def epoll_once
34
+ @wr_queue = [] # may contain String, ResponsePipe, and StreamFile objects
35
+ post_init
36
+ EP.set(self, IN) # wake up the main thread
37
+ rescue => e
38
+ Rainbows::Error.write(self, e)
39
+ end
40
+
41
+ def on_close
42
+ KATO.delete(self)
43
+ N.decr(0, 1) == THRESH and THREADS.each { |t| t.run }
44
+ end
45
+ end
data/pkg.mk ADDED
@@ -0,0 +1,171 @@
1
+ RUBY = ruby
2
+ RAKE = rake
3
+ RSYNC = rsync
4
+ WRONGDOC = wrongdoc
5
+
6
+ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7
+ @./GIT-VERSION-GEN
8
+ -include GIT-VERSION-FILE
9
+ -include local.mk
10
+ DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
11
+ RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
12
+ RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
13
+ lib := lib
14
+
15
+ ifeq ($(shell test -f script/isolate_for_tests && echo t),t)
16
+ isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/isolate.mk
17
+ $(isolate_libs): script/isolate_for_tests
18
+ @$(RUBY) script/isolate_for_tests
19
+ -include $(isolate_libs)
20
+ lib := $(lib):$(ISOLATE_LIBS)
21
+ endif
22
+
23
+ ext := $(firstword $(wildcard ext/*))
24
+ ifneq ($(ext),)
25
+ ext_pfx := tmp/ext/$(RUBY_ENGINE)-$(RUBY_VERSION)
26
+ ext_h := $(wildcard $(ext)/*/*.h $(ext)/*.h)
27
+ ext_src := $(wildcard $(ext)/*.c $(ext_h))
28
+ ext_pfx_src := $(addprefix $(ext_pfx)/,$(ext_src))
29
+ ext_d := $(ext_pfx)/$(ext)/.d
30
+ $(ext)/extconf.rb: $(wildcard $(ext)/*.h)
31
+ @>> $@
32
+ $(ext_d):
33
+ @mkdir -p $(@D)
34
+ @> $@
35
+ $(ext_pfx)/$(ext)/%: $(ext)/% $(ext_d)
36
+ install -m 644 $< $@
37
+ $(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_d) $(ext_h)
38
+ $(RM) -f $(@D)/*.o
39
+ cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb
40
+ ext_sfx := _ext.$(DLEXT)
41
+ ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
42
+ $(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
43
+ @echo $^ == $@
44
+ $(MAKE) -C $(@D)
45
+ lib := $(lib):$(ext_pfx)/$(ext)
46
+ build: $(ext_dl)
47
+ else
48
+ build:
49
+ endif
50
+
51
+ pkg_extra += GIT-VERSION-FILE NEWS ChangeLog LATEST
52
+ ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
53
+ $(WRONGDOC) prepare
54
+ NEWS LATEST: ChangeLog
55
+
56
+ manifest:
57
+ $(RM) .manifest
58
+ $(MAKE) .manifest
59
+
60
+ .manifest: $(pkg_extra)
61
+ (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
62
+ LC_ALL=C sort > $@+
63
+ cmp $@+ $@ || mv $@+ $@
64
+ $(RM) $@+
65
+
66
+ doc:: .document .wrongdoc.yml $(pkg_extra)
67
+ -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
68
+ -find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
69
+ $(RM) -r doc
70
+ $(WRONGDOC) all
71
+ install -m644 COPYING doc/COPYING
72
+ install -m644 $(shell grep '^[A-Z]' .document) doc/
73
+
74
+ ifneq ($(VERSION),)
75
+ pkggem := pkg/$(rfpackage)-$(VERSION).gem
76
+ pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
77
+ release_notes := release_notes-$(VERSION)
78
+ release_changes := release_changes-$(VERSION)
79
+
80
+ release-notes: $(release_notes)
81
+ release-changes: $(release_changes)
82
+ $(release_changes):
83
+ $(WRONGDOC) release_changes > $@+
84
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
85
+ $(release_notes):
86
+ $(WRONGDOC) release_notes > $@+
87
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
88
+
89
+ # ensures we're actually on the tagged $(VERSION), only used for release
90
+ verify:
91
+ test x"$(shell umask)" = x0022
92
+ git rev-parse --verify refs/tags/v$(VERSION)^{}
93
+ git diff-index --quiet HEAD^0
94
+ test $$(git rev-parse --verify HEAD^0) = \
95
+ $$(git rev-parse --verify refs/tags/v$(VERSION)^{})
96
+
97
+ fix-perms:
98
+ -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
99
+ -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
100
+
101
+ gem: $(pkggem)
102
+
103
+ install-gem: $(pkggem)
104
+ gem install $(CURDIR)/$<
105
+
106
+ $(pkggem): manifest fix-perms
107
+ gem build $(rfpackage).gemspec
108
+ mkdir -p pkg
109
+ mv $(@F) $@
110
+
111
+ $(pkgtgz): distdir = $(basename $@)
112
+ $(pkgtgz): HEAD = v$(VERSION)
113
+ $(pkgtgz): manifest fix-perms
114
+ @test -n "$(distdir)"
115
+ $(RM) -r $(distdir)
116
+ mkdir -p $(distdir)
117
+ tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
118
+ cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
119
+ mv $@+ $@
120
+
121
+ package: $(pkgtgz) $(pkggem)
122
+
123
+ test-release:: verify package $(release_notes) $(release_changes)
124
+ # make tgz release on RubyForge
125
+ @echo rubyforge add_release -f \
126
+ -n $(release_notes) -a $(release_changes) \
127
+ $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
128
+ @echo gem push $(pkggem)
129
+ @echo rubyforge add_file \
130
+ $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
131
+ release:: verify package $(release_notes) $(release_changes)
132
+ # make tgz release on RubyForge
133
+ rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
134
+ $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
135
+ # push gem to RubyGems.org
136
+ gem push $(pkggem)
137
+ # in case of gem downloads from RubyForge releases page
138
+ rubyforge add_file \
139
+ $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
140
+ else
141
+ gem install-gem: GIT-VERSION-FILE
142
+ $(MAKE) $@ VERSION=$(GIT_VERSION)
143
+ endif
144
+
145
+ all:: test
146
+ test_units := $(wildcard test/test_*.rb)
147
+ test: test-unit
148
+ test-unit: $(test_units)
149
+ $(test_units): build
150
+ $(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
151
+
152
+ # this requires GNU coreutils variants
153
+ ifneq ($(RSYNC_DEST),)
154
+ publish_doc:
155
+ -git set-file-times
156
+ $(MAKE) doc
157
+ find doc/images -type f | \
158
+ TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
159
+ $(MAKE) doc_gz
160
+ $(RSYNC) -av doc/ $(RSYNC_DEST)/
161
+ git ls-files | xargs touch
162
+ endif
163
+
164
+ # Create gzip variants of the same timestamp as the original so nginx
165
+ # "gzip_static on" can serve the gzipped versions directly.
166
+ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
167
+ doc_gz:
168
+ for i in $(docs); do \
169
+ gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
170
+
171
+ .PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
data/rainbows.gemspec CHANGED
@@ -19,17 +19,15 @@ Gem::Specification.new do |s|
19
19
  s.homepage = Wrongdoc.config[:rdoc_url]
20
20
  s.summary = summary
21
21
  s.rdoc_options = rdoc_options
22
- s.require_paths = %w(lib)
23
22
  s.rubyforge_project = %q{rainbows}
24
- s.test_files = []
25
23
 
26
24
  # we want a newer Rack for a valid HeaderHash#each
27
25
  s.add_dependency(%q<rack>, ['~> 1.1'])
28
26
 
29
27
  # we need Unicorn for the HTTP parser and process management
30
- s.add_dependency(%q<unicorn>, ["~> 3.3"])
28
+ s.add_dependency(%q<unicorn>, ["~> 3.4"])
31
29
  s.add_development_dependency(%q<isolate>, "~> 3.0.0")
32
- s.add_development_dependency(%q<wrongdoc>, "~> 1.1")
30
+ s.add_development_dependency(%q<wrongdoc>, "~> 1.5")
33
31
 
34
32
  # optional runtime dependencies depending on configuration
35
33
  # see t/test_isolate.rb for the exact versions we've tested with
data/t/GNUmakefile CHANGED
@@ -19,6 +19,10 @@ endif
19
19
  RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
20
20
  export RUBY_VERSION RUBY_ENGINE
21
21
 
22
+ ifeq (Linux,$(shell uname -s))
23
+ models += XEpoll
24
+ models += Epoll
25
+ endif
22
26
  models += WriterThreadPool
23
27
  models += WriterThreadSpawn
24
28
  models += ThreadPool
@@ -15,6 +15,7 @@ if ARGV.grep("--no-headers").empty?
15
15
  $stdout.write(
16
16
  "PUT / HTTP/1.1\r\n" \
17
17
  "Host: example.com\r\n" \
18
+ "Connection: #{ENV["Connection"] || 'close'}\r\n" \
18
19
  "Transfer-Encoding: chunked\r\n" \
19
20
  "Trailer: Content-MD5\r\n" \
20
21
  "\r\n"
@@ -1,10 +1,18 @@
1
1
  # must be run without Rack::Lint since that clobbers to_path
2
2
  use Rainbows::DevFdResponse
3
3
  run(lambda { |env|
4
+ io = case env["rainbows.model"].to_s
5
+ when /Fiber/
6
+ Rainbows::Fiber::IO::Pipe
7
+ else
8
+ Kgio::Pipe
9
+ end.popen('cat random_blob', 'rb')
10
+
4
11
  [ 200,
5
12
  {
6
13
  'Content-Length' => ::File.stat('random_blob').size.to_s,
7
14
  'Content-Type' => 'application/octet-stream',
8
15
  },
9
- Rainbows::Fiber::IO::Pipe.popen('cat random_blob', 'rb') ]
16
+ io
17
+ ]
10
18
  })
@@ -2,4 +2,9 @@ require 'rack/fiber_pool'
2
2
  use Rack::FiberPool
3
3
  use Rack::ContentLength
4
4
  use Rack::ContentType, 'text/plain'
5
- run lambda { |env| [ 200, {}, [ "#{Fiber.current}\n" ] ] }
5
+ run lambda { |env|
6
+ f = Fiber.current
7
+ EM.add_timer(3) { f.resume }
8
+ Fiber.yield
9
+ [ 200, {}, [ "#{f}\n" ] ]
10
+ }
@@ -0,0 +1,9 @@
1
+ use Rack::ContentLength
2
+ use Rack::ContentType
3
+ run lambda { |env|
4
+ if env['rack.multithread'] == false && env['rainbows.model'] == :Epoll
5
+ [ 200, {}, [ Thread.current.inspect << "\n" ] ]
6
+ else
7
+ raise env.inspect
8
+ end
9
+ }
@@ -0,0 +1,9 @@
1
+ use Rack::ContentLength
2
+ use Rack::ContentType
3
+ run lambda { |env|
4
+ if env['rack.multithread'] == false && env['rainbows.model'] == :XEpoll
5
+ [ 200, {}, [ Thread.current.inspect << "\n" ] ]
6
+ else
7
+ raise env.inspect
8
+ end
9
+ }
@@ -4,7 +4,7 @@ t_plan 6 "config variables conflict with preload_app"
4
4
 
5
5
  t_begin "setup and start" && {
6
6
  rainbows_setup
7
- rtmpfiles ru rutmp
7
+ rtmpfiles ru
8
8
 
9
9
  cat > $ru <<\EOF
10
10
  use Rack::ContentLength
@@ -23,8 +23,10 @@ t_begin "hit with curl" && {
23
23
  }
24
24
 
25
25
  t_begin "modify rackup file" && {
26
- sed -e 's/world/WORLD/' < $ru > $rutmp
27
- mv $rutmp $ru
26
+ ed -s $ru <<EOF
27
+ ,s/world/WORLD/
28
+ w
29
+ EOF
28
30
  }
29
31
 
30
32
  t_begin "reload signal succeeds" && {
@@ -9,13 +9,7 @@ ruby) ;;
9
9
  ;;
10
10
  esac
11
11
 
12
- case $model in
13
- EventMachine|NeverBlock)
14
- t_info "skipping $T since it's not compatible with $model"
15
- exit 0
16
- ;;
17
- *) ;;
18
- esac
12
+ skip_models EventMachine NeverBlock
19
13
 
20
14
  t_plan 13 "sendfile byte range response for $model"
21
15
 
@@ -22,12 +22,13 @@ require "kcar"
22
22
  $stdin.binmode
23
23
  expect = ENV["random_blob_sha1"]
24
24
  kcar = Kcar::Response.new($stdin, {})
25
- 3.times do
25
+ 3.times do |i|
26
26
  nr = 0
27
27
  status, headers, body = kcar.rack
28
28
  dig = Digest::SHA1.new
29
29
  body.each { |buf| dig << buf ; nr += buf.size }
30
30
  sha1 = dig.hexdigest
31
+ warn "[#{i}] nr: #{nr}"
31
32
  sha1 == expect or abort "mismatch: sha1=#{sha1} != expect=#{expect}"
32
33
  body.close
33
34
  end
@@ -1,13 +1,6 @@
1
1
  #!/bin/sh
2
2
  . ./test-lib.sh
3
3
  test -r random_blob || die "random_blob required, run with 'make $0'"
4
- case $model in
5
- *Fiber* ) ;;
6
- *)
7
- t_info "skipping $T since it's not compatible with $model"
8
- exit 0
9
- ;;
10
- esac
11
4
 
12
5
  t_plan 10 "fast Kgio pipe response for $model"
13
6
 
@@ -0,0 +1,51 @@
1
+ #!/bin/sh
2
+ . ./test-lib.sh
3
+
4
+ case $model in
5
+ NeverBlock|CoolioThreadPool) ;;
6
+ *)
7
+ t_info "skipping $T since it doesn't support :pool_size"
8
+ exit
9
+ ;;
10
+ esac
11
+
12
+ t_plan 6 "optional :pool_size argument for $model"
13
+
14
+ t_begin "setup and startup" && {
15
+ rtmpfiles curl_out curl_err
16
+ rainbows_setup $model
17
+ }
18
+
19
+ t_begin "fails with bad :pool_size" && {
20
+ ed -s $unicorn_config <<EOF
21
+ ,s/use :$model/use :$model, :pool_size => -666/
22
+ w
23
+ EOF
24
+ grep "pool_size" $unicorn_config
25
+ rainbows -D env.ru -c $unicorn_config || echo err=$? > $ok
26
+ test x"$(cat $ok)" = "xerr=1"
27
+ }
28
+
29
+ t_begin "starts with correct :pool_size" && {
30
+ ed -s $unicorn_config <<EOF
31
+ ,s/use :$model.*/use :$model, :pool_size => 6/
32
+ w
33
+ EOF
34
+ grep "pool_size" $unicorn_config
35
+ rainbows -D env.ru -c $unicorn_config
36
+ rainbows_wait_start
37
+ }
38
+
39
+ t_begin "regular TCP request works right" && {
40
+ curl -sSfv http://$listen/
41
+ }
42
+
43
+ t_begin "no errors in stderr" && {
44
+ check_stderr
45
+ }
46
+
47
+ t_begin "shutdown" && {
48
+ kill $rainbows_pid
49
+ }
50
+
51
+ t_done