public
Description: Koz's rails git-svn clone
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/NZKoz/koz-rails.git
Search Repo:
Update fcgi dispatcher test cases. Closes #11471 [guillaume]


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9220 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
bitsweat (author)
Thu Apr 03 13:00:33 -0700 2008
commit  5cfb940cad785cbf969849348029fa1f33dbd7a7
tree    778bbb91a17aadf6d89ec3613951bf6073022ff9
parent  fdbb05170776ce6eb0cad1855760ace9c5d5d1e7
...
59
60
61
62
 
63
 
64
65
66
 
67
68
69
...
131
132
133
134
 
135
136
137
...
144
145
146
147
 
148
149
150
...
157
158
159
160
 
161
162
163
...
171
172
173
174
 
175
176
177
178
...
181
182
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
185
186
187
 
188
189
190
...
59
60
61
 
62
63
64
65
66
 
67
68
69
70
...
132
133
134
 
135
136
137
138
...
145
146
147
 
148
149
150
151
...
158
159
160
 
161
162
163
164
...
172
173
174
 
175
176
177
178
179
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
 
203
204
205
206
0
@@ -59,11 +59,12 @@
0
     @handler.process!
0
   end
0
 
0
- def test_restart_handler
0
+ def test_restart_handler_outside_request
0
     @handler.expects(:dispatcher_log).with(:info, "asked to restart ASAP")
0
+ @handler.expects(:restart!).once
0
 
0
     @handler.send(:restart_handler, nil)
0
- assert_equal :restart, @handler.when_ready
0
+ assert_equal nil, @handler.when_ready
0
   end
0
 
0
   def test_install_signal_handler_should_log_on_bad_signal
0
@@ -131,7 +132,7 @@
0
   def test_interrupted_via_HUP_when_not_in_request
0
     cgi = mock
0
     FCGI.expects(:each_cgi).once.yields(cgi)
0
- @handler.expects(:gc_countdown).returns { Process.kill 'HUP', $$ }
0
+ @handler.expects(:gc_countdown).returns(lambda { Process.kill 'HUP', $$ } )
0
 
0
     @handler.expects(:reload!).once
0
     @handler.expects(:close_connection).never
0
@@ -144,7 +145,7 @@
0
   def test_interrupted_via_HUP_when_in_request
0
     cgi = mock
0
     FCGI.expects(:each_cgi).once.yields(cgi)
0
- Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'HUP', $$ }
0
+ Dispatcher.expects(:dispatch).with(cgi).returns( lambda { Process.kill 'HUP', $$ } )
0
 
0
     @handler.expects(:reload!).once
0
     @handler.expects(:close_connection).never
0
@@ -157,7 +158,7 @@
0
   def test_interrupted_via_USR1_when_not_in_request
0
     cgi = mock
0
     FCGI.expects(:each_cgi).once.yields(cgi)
0
- @handler.expects(:gc_countdown).returns { Process.kill 'USR1', $$ }
0
+ @handler.expects(:gc_countdown).returns( lambda { Process.kill 'USR1', $$ } )
0
     @handler.expects(:exit_handler).never
0
 
0
     @handler.expects(:reload!).never
0
@@ -171,7 +172,7 @@
0
   def test_interrupted_via_USR1_when_in_request
0
     cgi = mock
0
     FCGI.expects(:each_cgi).once.yields(cgi)
0
- Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'USR1', $$ }
0
+ Dispatcher.expects(:dispatch).with(cgi).returns( lambda { Process.kill 'USR1', $$ } )
0
 
0
     @handler.expects(:reload!).never
0
     @handler.expects(:close_connection).with(cgi).once
0
0
@@ -181,10 +182,25 @@
0
     assert_equal :exit, @handler.when_ready
0
   end
0
 
0
+ def test_restart_via_USR2_when_in_request
0
+ cgi = mock
0
+ FCGI.expects(:each_cgi).once.yields(cgi)
0
+ @handler.expects(:gc_countdown).returns( lambda { Process.kill 'USR2', $$ } )
0
+ @handler.expects(:exit_handler).never
0
+
0
+ @handler.expects(:reload!).never
0
+ @handler.expects(:close_connection).with(cgi).once
0
+ @handler.expects(:exit).never
0
+ @handler.expects(:restart!).once
0
+
0
+ @handler.process!
0
+ assert_equal :restart, @handler.when_ready
0
+ end
0
+
0
   def test_interrupted_via_TERM
0
     cgi = mock
0
     FCGI.expects(:each_cgi).once.yields(cgi)
0
- Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'TERM', $$ }
0
+ Dispatcher.expects(:dispatch).with(cgi).returns(lambda { Process.kill 'TERM', $$ })
0
 
0
     @handler.expects(:reload!).never
0
     @handler.expects(:close_connection).never

Comments

    No one has commented yet.