Skip to content

Commit f3af68e

Browse files
andrewhughes101codebytere
authored andcommitted
test: prefer server over srv
PR-URL: #31224 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 60e35d4 commit f3af68e

6 files changed

+20
-20
lines changed

test/parallel/test-http-server-multiheaders.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require('../common');
2828
const assert = require('assert');
2929
const http = require('http');
3030

31-
const srv = http.createServer(function(req, res) {
31+
const server = http.createServer(function(req, res) {
3232
assert.strictEqual(req.headers.accept, 'abc, def, ghijklmnopqrst');
3333
assert.strictEqual(req.headers.host, 'foo');
3434
assert.strictEqual(req.headers['www-authenticate'], 'foo, bar, baz');
@@ -43,10 +43,10 @@ const srv = http.createServer(function(req, res) {
4343
res.writeHead(200, { 'Content-Type': 'text/plain' });
4444
res.end('EOF');
4545

46-
srv.close();
46+
server.close();
4747
});
4848

49-
srv.listen(0, function() {
49+
server.listen(0, function() {
5050
http.get({
5151
host: 'localhost',
5252
port: this.address().port,

test/parallel/test-http-server-multiheaders2.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const multipleForbidden = [
6969
// 'Content-Length',
7070
];
7171

72-
const srv = http.createServer(function(req, res) {
72+
const server = http.createServer(function(req, res) {
7373
multipleForbidden.forEach(function(header) {
7474
assert.strictEqual(req.headers[header.toLowerCase()], 'foo',
7575
`header parsed incorrectly: ${header}`);
@@ -83,7 +83,7 @@ const srv = http.createServer(function(req, res) {
8383
res.writeHead(200, { 'Content-Type': 'text/plain' });
8484
res.end('EOF');
8585

86-
srv.close();
86+
server.close();
8787
});
8888

8989
function makeHeader(value) {
@@ -98,7 +98,7 @@ const headers = []
9898
.concat(multipleAllowed.map(makeHeader('bar')))
9999
.concat(multipleForbidden.map(makeHeader('bar')));
100100

101-
srv.listen(0, function() {
101+
server.listen(0, function() {
102102
http.get({
103103
host: 'localhost',
104104
port: this.address().port,

test/parallel/test-http-upgrade-agent.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const http = require('http');
3131
const net = require('net');
3232

3333
// Create a TCP server
34-
const srv = net.createServer(function(c) {
34+
const server = net.createServer(function(c) {
3535
c.on('data', function(d) {
3636
c.write('HTTP/1.1 101\r\n');
3737
c.write('hello: world\r\n');
@@ -46,7 +46,7 @@ const srv = net.createServer(function(c) {
4646
});
4747
});
4848

49-
srv.listen(0, '127.0.0.1', common.mustCall(function() {
49+
server.listen(0, '127.0.0.1', common.mustCall(function() {
5050

5151
const options = {
5252
port: this.address().port,
@@ -82,7 +82,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() {
8282

8383
req.on('close', common.mustCall(function() {
8484
socket.end();
85-
srv.close();
85+
server.close();
8686
}));
8787
}));
8888
}));

test/parallel/test-http-upgrade-client.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Countdown = require('../common/countdown');
3434
const expectedRecvData = 'nurtzo';
3535

3636
// Create a TCP server
37-
const srv = net.createServer(function(c) {
37+
const server = net.createServer(function(c) {
3838
c.on('data', function(d) {
3939
c.write('HTTP/1.1 101\r\n');
4040
c.write('hello: world\r\n');
@@ -49,7 +49,7 @@ const srv = net.createServer(function(c) {
4949
});
5050
});
5151

52-
srv.listen(0, '127.0.0.1', common.mustCall(function() {
52+
server.listen(0, '127.0.0.1', common.mustCall(function() {
5353
const port = this.address().port;
5454
const headers = [
5555
{
@@ -63,7 +63,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() {
6363
['Origin', 'http://www.websocket.org']
6464
]
6565
];
66-
const countdown = new Countdown(headers.length, () => srv.close());
66+
const countdown = new Countdown(headers.length, () => server.close());
6767

6868
headers.forEach(function(h) {
6969
const req = http.get({

test/parallel/test-net-error-twice.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ function ready() {
3737
}
3838
}
3939

40-
const srv = net.createServer(function onConnection(conn) {
40+
const server = net.createServer(function onConnection(conn) {
4141
conn.on('error', function(err) {
4242
errs.push(err);
4343
if (errs.length > 1 && errs[0] === errs[1])
4444
assert.fail('Should not emit the same error twice');
4545
});
4646
conn.on('close', function() {
47-
srv.unref();
47+
server.unref();
4848
});
4949
serverSocket = conn;
5050
ready();

test/parallel/test-net-server-listen-path.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function randomPipePath() {
5555
{
5656
const handlePath = randomPipePath();
5757

58-
const srv = net.createServer()
58+
const server = net.createServer()
5959
.listen({
6060
path: handlePath,
6161
readableAll: true,
@@ -66,24 +66,24 @@ function randomPipePath() {
6666
assert.notStrictEqual(mode & fs.constants.S_IROTH, 0);
6767
assert.notStrictEqual(mode & fs.constants.S_IWOTH, 0);
6868
}
69-
srv.close();
69+
server.close();
7070
}));
7171
}
7272

7373
// Test should emit "error" events when listening fails.
7474
{
7575
const handlePath = randomPipePath();
76-
const srv1 = net.createServer().listen({ path: handlePath }, () => {
76+
const server1 = net.createServer().listen({ path: handlePath }, () => {
7777
// As the handlePath is in use, binding to the same address again should
7878
// make the server emit an 'EADDRINUSE' error.
79-
const srv2 = net.createServer()
79+
const server2 = net.createServer()
8080
.listen({
8181
path: handlePath,
8282
writableAll: true,
8383
}, common.mustNotCall());
8484

85-
srv2.on('error', common.mustCall((err) => {
86-
srv1.close();
85+
server2.on('error', common.mustCall((err) => {
86+
server1.close();
8787
assert.strictEqual(err.code, 'EADDRINUSE');
8888
assert(/^listen EADDRINUSE: address already in use/.test(err.message));
8989
}));

0 commit comments

Comments
 (0)