Skip to content

Commit 420c22b

Browse files
committed
test: adds linux-only test for abstract sockets
Introduce a new linux-only test for binding to an abstract unix socket and then making an http request against that socket. Refs: #49656
1 parent 6c2c61f commit 420c22b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const http = require('http');
5+
6+
if (!common.isLinux) common.skip();
7+
8+
const server = http.createServer(
9+
common.mustCall((req, res) => {
10+
res.end('ok');
11+
})
12+
);
13+
14+
server.listen(
15+
'\0abstract',
16+
common.mustCall(() => {
17+
http.get(
18+
{
19+
socketPath: server.address(),
20+
},
21+
common.mustCall((res) => {
22+
assert.strictEqual(res.statusCode, 200);
23+
server.close();
24+
})
25+
);
26+
})
27+
);

0 commit comments

Comments
 (0)