We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Fix a few bugs in ApplicationPoolTest
Hongli Lai (Phusion) (author)
Fri Feb 29 09:13:36 -0800 2008
commit  0d93c705f2dc45912a493cb00f8646d24bc6c820
tree    f2f6c1fcd11883b76b6469ab8c817fc45e49c6f8
parent  ee90df8903bf483adf5d32ba188b23d1f316eb76
...
72
73
74
75
 
76
77
78
...
82
83
84
85
 
86
87
88
89
 
90
91
92
93
 
94
95
96
97
 
98
99
100
...
109
110
111
112
 
113
114
115
...
121
122
123
124
 
125
126
127
...
133
134
135
136
 
137
138
139
...
173
174
175
176
 
177
178
179
180
181
182
183
 
184
185
186
...
206
207
208
209
 
210
211
212
...
227
228
229
230
 
231
232
233
...
243
244
245
246
 
247
248
249
...
263
264
265
266
 
267
268
269
...
288
289
290
291
 
292
293
294
...
313
314
315
316
 
317
318
319
...
333
334
335
336
 
337
338
339
...
72
73
74
 
75
76
77
78
...
82
83
84
 
85
86
87
88
 
89
90
91
92
 
93
94
95
96
 
97
98
99
100
...
109
110
111
 
112
113
114
115
...
121
122
123
 
124
125
126
127
...
133
134
135
 
136
137
138
139
...
173
174
175
 
176
177
178
179
180
181
182
 
183
184
185
186
...
206
207
208
 
209
210
211
212
...
227
228
229
 
230
231
232
233
...
243
244
245
 
246
247
248
249
...
263
264
265
 
266
267
268
269
...
288
289
290
 
291
292
293
294
...
313
314
315
 
316
317
318
319
...
333
334
335
 
336
337
338
339
0
@@ -72,7 +72,7 @@ using namespace boost;
0
     ensure_equals("After the session is closed, the app is kept around", pool->getCount(), 1u);
0
   }
0
   
0
- TEST_METHOD(4) {
0
+ TEST_METHOD(3) {
0
     // If we call get() with an application root, then we close the session,
0
     // and then we call get() again with the same application root,
0
     // then the pool should not have spawned more than 1 app in total.
0
@@ -82,19 +82,19 @@ using namespace boost;
0
     ensure_equals(pool->getCount(), 1u);
0
   }
0
   
0
- TEST_METHOD(5) {
0
+ TEST_METHOD(4) {
0
     // If we call get() with an application root, then we call get() again before closing
0
     // the session, then the pool should have spawned 2 apps in total.
0
     Application::SessionPtr session(pool->get("stub/railsapp"));
0
- Application::SessionPtr session2(pool->get("stub/railsapp"));
0
+ Application::SessionPtr session2(pool2->get("stub/railsapp"));
0
     ensure_equals(pool->getCount(), 2u);
0
   }
0
   
0
- TEST_METHOD(6) {
0
+ TEST_METHOD(5) {
0
     // If we call get() twice with different application roots,
0
     // then the pool should spawn two different apps.
0
     Application::SessionPtr session(pool->get("stub/railsapp"));
0
- Application::SessionPtr session2(pool->get("stub/railsapp2"));
0
+ Application::SessionPtr session2(pool2->get("stub/railsapp2"));
0
     ensure_equals("Before the sessions were closed, both apps were busy", pool->getActive(), 2u);
0
     ensure_equals("Before the sessions were closed, both apps were in the pool", pool->getCount(), 2u);
0
     
0
@@ -109,7 +109,7 @@ using namespace boost;
0
     session2.reset();
0
   }
0
   
0
- TEST_METHOD(7) {
0
+ TEST_METHOD(6) {
0
     // If we call get() twice with different application roots,
0
     // and we close both sessions, then both 2 apps should still
0
     // be in the pool.
0
@@ -121,7 +121,7 @@ using namespace boost;
0
     ensure_equals(pool->getCount(), 2u);
0
   }
0
   
0
- TEST_METHOD(8) {
0
+ TEST_METHOD(7) {
0
     // If we call get() even though the pool is already full
0
     // (active == max), and the application root is already
0
     // in the pool, then the pool should have tried to open
0
@@ -133,7 +133,7 @@ using namespace boost;
0
     ensure_equals("No new app has been spawned", pool->getCount(), 1u);
0
   }
0
   
0
- TEST_METHOD(9) {
0
+ TEST_METHOD(8) {
0
     // If ApplicationPool spawns a new instance,
0
     // and we kill it, then the next get() with the
0
     // same application root should throw an exception.
0
@@ -173,14 +173,14 @@ using namespace boost;
0
     }
0
   };
0
 
0
- TEST_METHOD(10) {
0
+ TEST_METHOD(9) {
0
     // If we call get() even though the pool is already full
0
     // (active == max), and the application root is *not* already
0
     // in the pool, then the pool will wait until enough sessions
0
     // have been closed.
0
     pool->setMax(2);
0
     Application::SessionPtr session1(pool->get("stub/railsapp"));
0
- Application::SessionPtr session2(pool->get("stub/railsapp"));
0
+ Application::SessionPtr session2(pool2->get("stub/railsapp"));
0
     Application::SessionPtr session3;
0
     bool done;
0
     
0
@@ -206,7 +206,7 @@ using namespace boost;
0
     delete thr;
0
   }
0
   
0
- TEST_METHOD(12) {
0
+ TEST_METHOD(10) {
0
     // If we call get(), and:
0
     // * the pool is already full, but there are inactive apps
0
     // (active < count && count == max)
0
@@ -227,7 +227,7 @@ using namespace boost;
0
     ensure_equals(pool->getCount(), 2u);
0
   }
0
   
0
- TEST_METHOD(13) {
0
+ TEST_METHOD(11) {
0
     // Test whether Session is still usable after the Application has been destroyed.
0
     Application::SessionPtr session(pool->get("stub/railsapp"));
0
     pool->clear();
0
@@ -243,7 +243,7 @@ using namespace boost;
0
     ensure(result.find("hello world") != string::npos);
0
   }
0
   
0
- TEST_METHOD(14) {
0
+ TEST_METHOD(12) {
0
     // If tmp/restart.txt is present, then the applications under app_root
0
     // should be restarted.
0
     struct stat buf;
0
@@ -263,7 +263,7 @@ using namespace boost;
0
       && errno == ENOENT);
0
   }
0
   
0
- TEST_METHOD(15) {
0
+ TEST_METHOD(13) {
0
     // If tmp/restart.txt is present, but cannot be deleted, then
0
     // the applications under app_root should still be restarted.
0
     // However, a subsequent get() should not result in a restart.
0
@@ -288,7 +288,7 @@ using namespace boost;
0
     unlink("stub/railsapp/tmp/restart.txt");
0
   }
0
   
0
- TEST_METHOD(16) {
0
+ TEST_METHOD(14) {
0
     // If tmp/restart.txt is present, but cannot be deleted, then
0
     // the applications under app_root should still be restarted.
0
     // A subsequent get() should only restart if we've changed
0
@@ -313,7 +313,7 @@ using namespace boost;
0
     unlink("stub/railsapp/tmp/restart.txt");
0
   }
0
   
0
- TEST_METHOD(17) {
0
+ TEST_METHOD(15) {
0
     // Test whether restarting really results in code reload.
0
     system("cp -f stub/railsapp/app/controllers/bar_controller_1.rb "
0
       "stub/railsapp/app/controllers/bar_controller.rb");
0
@@ -333,7 +333,7 @@ using namespace boost;
0
     unlink("stub/railsapp/app/controllers/bar_controller.rb");
0
   }
0
   
0
- TEST_METHOD(18) {
0
+ TEST_METHOD(16) {
0
     // The cleaner thread should clean idle applications without crashing.
0
     pool->setMaxIdleTime(1);
0
     pool->get("stub/minimal-railsapp");

Comments

    No one has commented yet.