Browse Source

In tests, wait for 'listening' before connecting

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
0301adf9b4
  1. 2
      test/pummel/test-keep-alive.js
  2. 2
      test/simple/test-http-cat.js

2
test/pummel/test-keep-alive.js

@ -42,6 +42,7 @@ function runAb(opts, callback) {
}); });
} }
server.addListener('listening', function () {
runAb("-k -c 100 -t 2", function (reqSec, keepAliveRequests) { runAb("-k -c 100 -t 2", function (reqSec, keepAliveRequests) {
keepAliveReqSec = reqSec; keepAliveReqSec = reqSec;
assert.equal(true, keepAliveRequests > 0); assert.equal(true, keepAliveRequests > 0);
@ -54,6 +55,7 @@ runAb("-k -c 100 -t 2", function (reqSec, keepAliveRequests) {
server.close(); server.close();
}); });
}); });
});
process.addListener("exit", function () { process.addListener("exit", function () {
assert.equal(true, normalReqSec > 50); assert.equal(true, normalReqSec > 50);

2
test/simple/test-http-cat.js

@ -16,6 +16,7 @@ server.listen(PORT);
var got_good_server_content = false; var got_good_server_content = false;
var bad_server_got_error = false; var bad_server_got_error = false;
server.addListener('listening', function () {
http.cat("http://localhost:"+PORT+"/", "utf8", function (err, content) { http.cat("http://localhost:"+PORT+"/", "utf8", function (err, content) {
if (err) { if (err) {
throw err; throw err;
@ -33,6 +34,7 @@ http.cat("http://localhost:12312/", "utf8", function (err, content) {
bad_server_got_error = true; bad_server_got_error = true;
} }
}); });
});
process.addListener("exit", function () { process.addListener("exit", function () {
puts("exit"); puts("exit");

Loading…
Cancel
Save