Browse Source

Tests on common port.

v0.7.4-release
arlolra 15 years ago
committed by Ryan Dahl
parent
commit
724ccf10df
  1. 1
      test/common.js
  2. 1
      test/disabled/test-cat.js
  3. 2
      test/disabled/test-dns.js
  4. 2
      test/disabled/test-eio-race3.js
  5. 3
      test/disabled/test-fs-sendfile.js
  6. 1
      test/disabled/test-http-stress.js
  7. 2
      test/pummel/test-http-client-reconnect-bug.js
  8. 1
      test/pummel/test-keep-alive.js
  9. 1
      test/pummel/test-multipart.js
  10. 7
      test/pummel/test-tcp-many-clients.js
  11. 2
      test/pummel/test-tcp-pingpong-delay.js
  12. 7
      test/pummel/test-tcp-pingpong.js
  13. 1
      test/pummel/test-tcp-throttle-kernel-buffer.js
  14. 1
      test/pummel/test-tcp-throttle.js
  15. 7
      test/pummel/test-tcp-timeout.js
  16. 4
      test/pummel/test-tcp-tls.js
  17. 6
      test/simple/test-http-1.0.js
  18. 1
      test/simple/test-http-cat.js
  19. 1
      test/simple/test-http-chunked.js
  20. 1
      test/simple/test-http-client-race.js
  21. 1
      test/simple/test-http-client-upload.js
  22. 5
      test/simple/test-http-eof-on-connect.js
  23. 5
      test/simple/test-http-malformed-request.js
  24. 4
      test/simple/test-http-proxy.js
  25. 6
      test/simple/test-http-server.js
  26. 1
      test/simple/test-http-tls.js
  27. 6
      test/simple/test-http-wget.js
  28. 1
      test/simple/test-http.js
  29. 1
      test/simple/test-remote-module-loading.js
  30. 1
      test/simple/test-tcp-binary.js
  31. 7
      test/simple/test-tcp-reconnect.js

1
test/common.js

@ -3,6 +3,7 @@ var path = require("path");
exports.testDir = path.dirname(__filename); exports.testDir = path.dirname(__filename);
exports.fixturesDir = path.join(exports.testDir, "fixtures"); exports.fixturesDir = path.join(exports.testDir, "fixtures");
exports.libDir = path.join(exports.testDir, "../lib"); exports.libDir = path.join(exports.testDir, "../lib");
exports.PORT = 12346;
require.paths.unshift(exports.libDir); require.paths.unshift(exports.libDir);

1
test/disabled/test-cat.js

@ -1,6 +1,5 @@
process.mixin(require("../common.js")); process.mixin(require("../common.js"));
http = require("/http.js"); http = require("/http.js");
PORT = 8888;
puts("hello world"); puts("hello world");

2
test/disabled/test-dns.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var dns = require("dns"), var dns = require("dns"),
sys = require("sys"); sys = require("sys");

2
test/disabled/test-eio-race3.js

@ -1,6 +1,6 @@
/* XXX Can this test be modified to not call the now-removed wait()? */ /* XXX Can this test be modified to not call the now-removed wait()? */
process.mixin(require("./common")); process.mixin(require("../common"));
puts('first stat ...'); puts('first stat ...');

3
test/disabled/test-fs-sendfile.js

@ -1,8 +1,7 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
sys = require("sys"); sys = require("sys");
PORT = 23123;
var x = path.join(fixturesDir, "x.txt"); var x = path.join(fixturesDir, "x.txt");
var expected = "xyz"; var expected = "xyz";

1
test/disabled/test-http-stress.js

@ -1,6 +1,5 @@
process.mixin(require('../common.js')); process.mixin(require('../common.js'));
var PORT = 8003;
var request_count = 1000; var request_count = 1000;
var response_body = '{"ok": true}'; var response_body = '{"ok": true}';

2
test/pummel/test-http-client-reconnect-bug.js

@ -4,8 +4,6 @@ var tcp = require("tcp"),
sys = require("sys"), sys = require("sys"),
http = require("http"); http = require("http");
var PORT = 2143;
var errorCount = 0; var errorCount = 0;
var eofCount = 0; var eofCount = 0;

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

@ -2,7 +2,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
sys = require("sys"); sys = require("sys");
PORT = 8891;
body = "hello world\n"; body = "hello world\n";
server = http.createServer(function (req, res) { server = http.createServer(function (req, res) {

1
test/pummel/test-multipart.js

@ -3,7 +3,6 @@ process.mixin(require("../common"));
var http = require("http"), var http = require("http"),
multipart = require("multipart"), multipart = require("multipart"),
sys = require("sys"), sys = require("sys"),
PORT = 8222,
fixture = require("../fixtures/multipart"), fixture = require("../fixtures/multipart"),
events = require("events"), events = require("events"),
testPart = function (expect, part) { testPart = function (expect, part) {

7
test/pummel/test-tcp-many-clients.js

@ -1,7 +1,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
// settings // settings
var port = 20743;
var bytes = 1024*40; var bytes = 1024*40;
var concurrency = 100; var concurrency = 100;
var connections_per_client = 5; var connections_per_client = 5;
@ -22,10 +21,10 @@ var server = tcp.createServer(function (c) {
c.close(); c.close();
}); });
}); });
server.listen(port); server.listen(PORT);
function runClient (callback) { function runClient (callback) {
var client = tcp.createConnection(port); var client = tcp.createConnection(PORT);
client.connections = 0; client.connections = 0;
client.setEncoding("utf8"); client.setEncoding("utf8");
@ -48,7 +47,7 @@ function runClient (callback) {
assert.equal(false, had_error); assert.equal(false, had_error);
assert.equal(bytes, client.recved.length); assert.equal(bytes, client.recved.length);
if (this.connections < connections_per_client) { if (this.connections < connections_per_client) {
this.connect(port); this.connect(PORT);
} else { } else {
callback(); callback();
} }

2
test/pummel/test-tcp-pingpong-delay.js

@ -84,7 +84,7 @@ function pingPongTest (port, host, on_complete) {
}); });
} }
pingPongTest(21988); pingPongTest(PORT);
process.addListener("exit", function () { process.addListener("exit", function () {
assert.equal(1, tests_run); assert.equal(1, tests_run);

7
test/pummel/test-tcp-pingpong.js

@ -1,7 +1,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
var tests_run = 0; var tests_run = 0;
function pingPongTest (port, host, on_complete) { function pingPongTest (port, host, on_complete) {
@ -81,9 +80,9 @@ function pingPongTest (port, host, on_complete) {
} }
/* All are run at once, so run on different ports */ /* All are run at once, so run on different ports */
pingPongTest(20989, "localhost"); pingPongTest(PORT, "localhost");
pingPongTest(20988, null); pingPongTest(PORT+1, null);
pingPongTest(20997, "::1"); pingPongTest(PORT+2, "::1");
process.addListener("exit", function () { process.addListener("exit", function () {
assert.equal(3, tests_run); assert.equal(3, tests_run);

1
test/pummel/test-tcp-throttle-kernel-buffer.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
PORT = 20444;
N = 30*1024; // 500kb N = 30*1024; // 500kb
puts("build big string"); puts("build big string");

1
test/pummel/test-tcp-throttle.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
PORT = 20443;
N = 200; N = 200;
server = tcp.createServer(function (connection) { server = tcp.createServer(function (connection) {

7
test/pummel/test-tcp-timeout.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
port = 9992;
exchanges = 0; exchanges = 0;
starttime = null; starttime = null;
timeouttime = null; timeouttime = null;
@ -25,10 +24,10 @@ var echo_server = tcp.createServer(function (socket) {
}); });
}); });
echo_server.listen(port); echo_server.listen(PORT);
puts("server listening at " + port); puts("server listening at " + PORT);
var client = tcp.createConnection(port); var client = tcp.createConnection(PORT);
client.setEncoding("UTF8"); client.setEncoding("UTF8");
client.setTimeout(0); // disable the timeout for client client.setTimeout(0); // disable the timeout for client
client.addListener("connect", function () { client.addListener("connect", function () {

4
test/pummel/test-tcp-tls.js

@ -110,8 +110,8 @@ if (have_tls) {
var keyPem = fs.readFileSync(fixturesDir+"/test_key.pem"); var keyPem = fs.readFileSync(fixturesDir+"/test_key.pem");
/* All are run at once, so run on different ports */ /* All are run at once, so run on different ports */
tlsTest(20443, "localhost", caPem, keyPem, certPem); tlsTest(PORT, "localhost", caPem, keyPem, certPem);
tlsTest(21443, null, caPem, keyPem, certPem); tlsTest(PORT+1, null, caPem, keyPem, certPem);
process.addListener("exit", function () { process.addListener("exit", function () {
assert.equal(2, tests_run); assert.equal(2, tests_run);

6
test/simple/test-http-1.0.js

@ -2,8 +2,6 @@ process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
http = require("http"); http = require("http");
var port = 7333;
var body = "hello world\n"; var body = "hello world\n";
var server_response = ""; var server_response = "";
var client_got_eof = false; var client_got_eof = false;
@ -13,9 +11,9 @@ var server = http.createServer(function (req, res) {
res.write(body); res.write(body);
res.close(); res.close();
}) })
server.listen(port); server.listen(PORT);
var c = tcp.createConnection(port); var c = tcp.createConnection(PORT);
c.setEncoding("utf8"); c.setEncoding("utf8");

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

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
PORT = 8888;
var body = "exports.A = function() { return 'A';}"; var body = "exports.A = function() { return 'A';}";
var server = http.createServer(function (req, res) { var server = http.createServer(function (req, res) {

1
test/simple/test-http-chunked.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
var http = require("http"); var http = require("http");
var PORT = 8888;
var UTF8_STRING = "Il était tué"; var UTF8_STRING = "Il était tué";

1
test/simple/test-http-client-race.js

@ -1,7 +1,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
PORT = 8888;
var body1_s = "1111111111111111"; var body1_s = "1111111111111111";
var body2_s = "22222"; var body2_s = "22222";

1
test/simple/test-http-client-upload.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
var PORT = 18032;
var sent_body = ""; var sent_body = "";
var server_req_complete = false; var server_req_complete = false;

5
test/simple/test-http-eof-on-connect.js

@ -5,12 +5,11 @@ http = require("http");
// This is a regression test for http://github.com/ry/node/issues/#issue/44 // This is a regression test for http://github.com/ry/node/issues/#issue/44
// It is separate from test-http-malformed-request.js because it is only // It is separate from test-http-malformed-request.js because it is only
// reproduceable on the first packet on the first connection to a server. // reproduceable on the first packet on the first connection to a server.
port = 9999;
server = http.createServer(function (req, res) {}); server = http.createServer(function (req, res) {});
server.listen(port); server.listen(PORT);
tcp.createConnection(port).addListener("connect", function () { tcp.createConnection(PORT).addListener("connect", function () {
this.close(); this.close();
}).addListener("close", function () { }).addListener("close", function () {
server.close(); server.close();

5
test/simple/test-http-malformed-request.js

@ -5,7 +5,6 @@ url = require("url");
// Make sure no exceptions are thrown when receiving malformed HTTP // Make sure no exceptions are thrown when receiving malformed HTTP
// requests. // requests.
port = 9999;
nrequests_completed = 0; nrequests_completed = 0;
nrequests_expected = 1; nrequests_expected = 1;
@ -19,9 +18,9 @@ var s = http.createServer(function (req, res) {
if (++nrequests_completed == nrequests_expected) s.close(); if (++nrequests_completed == nrequests_expected) s.close();
}); });
s.listen(port); s.listen(PORT);
var c = tcp.createConnection(port); var c = tcp.createConnection(PORT);
c.addListener("connect", function () { c.addListener("connect", function () {
c.write("GET /hello?foo=%99bar HTTP/1.1\r\n\r\n"); c.write("GET /hello?foo=%99bar HTTP/1.1\r\n\r\n");
c.close(); c.close();

4
test/simple/test-http-proxy.js

@ -2,8 +2,8 @@ process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
var PROXY_PORT = 8869; var PROXY_PORT = PORT;
var BACKEND_PORT = 8870; var BACKEND_PORT = PORT+1;
var backend = http.createServer(function (req, res) { var backend = http.createServer(function (req, res) {
// debug("backend"); // debug("backend");

6
test/simple/test-http-server.js

@ -4,8 +4,6 @@ http = require("http");
url = require("url"); url = require("url");
qs = require("querystring"); qs = require("querystring");
var port = 8222;
var request_number = 0; var request_number = 0;
var requests_sent = 0; var requests_sent = 0;
var server_response = ""; var server_response = "";
@ -43,9 +41,9 @@ http.createServer(function (req, res) {
res.close(); res.close();
}, 1); }, 1);
}).listen(port); }).listen(PORT);
var c = tcp.createConnection(port); var c = tcp.createConnection(PORT);
c.setEncoding("utf8"); c.setEncoding("utf8");

1
test/simple/test-http-tls.js

@ -1,7 +1,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
PORT = 8888;
HOST = "localhost"; HOST = "localhost";

6
test/simple/test-http-wget.js

@ -17,8 +17,6 @@ http = require("http");
// content-length is not provided, that the connection is in fact // content-length is not provided, that the connection is in fact
// closed. // closed.
var port = 7333;
var server_response = ""; var server_response = "";
var client_got_eof = false; var client_got_eof = false;
var connection_was_closed = false; var connection_was_closed = false;
@ -29,9 +27,9 @@ var server = http.createServer(function (req, res) {
res.write("world\n"); res.write("world\n");
res.close(); res.close();
}) })
server.listen(port); server.listen(PORT);
var c = tcp.createConnection(port); var c = tcp.createConnection(PORT);
c.setEncoding("utf8"); c.setEncoding("utf8");

1
test/simple/test-http.js

@ -1,7 +1,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
PORT = 8888;
var responses_sent = 0; var responses_sent = 0;
var responses_recvd = 0; var responses_recvd = 0;

1
test/simple/test-remote-module-loading.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
var PORT = 8889;
var http = require('http'); var http = require('http');
var sys = require('sys'); var sys = require('sys');
var url = require("url"); var url = require("url");

1
test/simple/test-tcp-binary.js

@ -1,6 +1,5 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
PORT = 23123;
binaryString = ""; binaryString = "";
for (var i = 255; i >= 0; i--) { for (var i = 255; i >= 0; i--) {

7
test/simple/test-tcp-reconnect.js

@ -1,7 +1,6 @@
process.mixin(require("../common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
var N = 50; var N = 50;
var port = 8921;
var c = 0; var c = 0;
var client_recv_count = 0; var client_recv_count = 0;
@ -21,9 +20,9 @@ var server = tcp.createServer(function (socket) {
assert.equal(false, had_error); assert.equal(false, had_error);
}); });
}); });
server.listen(port); server.listen(PORT);
var client = tcp.createConnection(port); var client = tcp.createConnection(PORT);
client.setEncoding("UTF8"); client.setEncoding("UTF8");
@ -42,7 +41,7 @@ client.addListener("close", function (had_error) {
puts("disconnect"); puts("disconnect");
assert.equal(false, had_error); assert.equal(false, had_error);
if (disconnect_count++ < N) if (disconnect_count++ < N)
client.connect(port); // reconnect client.connect(PORT); // reconnect
else else
server.close(); server.close();
}); });

Loading…
Cancel
Save