Skip to content

Commit 2df52cb

Browse files
committed
Fix slightly incorrect remotePort test assertions
The ephemeral port range starts at 32768, not 32769, so we should accept 32768 as a valid client port in these tests - it should be gte, not gt.
1 parent 8252069 commit 2df52cb

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@
119119
"browserify-zlib": "^0.2.0",
120120
"buffer": "^6.0.3",
121121
"catch-uncommitted": "^1.0.0",
122-
"chai": "^3.5.0",
123-
"chai-as-promised": "^6.0.0",
122+
"chai": "^4.3.7",
123+
"chai-as-promised": "^7.1.1",
124124
"chai-fetch": "^0.3.1",
125125
"crypto-browserify": "^3.12.0",
126126
"dns2": "1.4.2",

test/integration/http2.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ nodeOnly(() => {
290290

291291
const proxiedResponseHeaders = await getHttp2Response(proxiedRequest);
292292

293-
expect(_.omit(proxiedResponseHeaders, 'date')).to.deep.equal({
293+
expect(
294+
_.omit(proxiedResponseHeaders, ['date', http2.sensitiveHeaders])
295+
).to.deep.equal({
294296
':status': 200,
295297
'header-key': 'HEADER-VALUE' // We lowercase all header keys
296298
// Connection: close is omitted
@@ -414,7 +416,7 @@ nodeOnly(() => {
414416
'::ffff:127.0.0.1', // IPv4 localhost
415417
'::1' // IPv6 localhost
416418
]);
417-
expect(seenRequest.remotePort).to.be.greaterThan(32768);
419+
expect(seenRequest.remotePort).to.be.greaterThanOrEqual(32768);
418420

419421
await cleanup(proxiedClient, client);
420422
});

test/integration/proxying/https-proxying.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,8 @@ nodeOnly(() => {
780780
const response = await http2ProxyRequest(server, `https://localhost:${targetPort}/`);
781781

782782
expect(
783-
_.omit(response.headers, 'date') // https://github.com/nodejs/node/issues/34841
783+
// N.b. https://github.com/nodejs/node/issues/34841
784+
_.omit(response.headers, ['date', http2.sensitiveHeaders])
784785
).to.deep.equal({
785786
':status': 200,
786787
'replacement-header': 'added'

test/integration/subscriptions/client-error-events.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe("Client error subscription", () => {
6161
'::ffff:127.0.0.1', // IPv4 localhost
6262
'::1' // IPv6 localhost
6363
]);
64-
expect(clientError.request.remotePort).to.be.greaterThan(32768);
64+
expect(clientError.request.remotePort).to.be.greaterThanOrEqual(32768);
6565

6666
const response = clientError.response as CompletedResponse;
6767
expect(response.statusCode).to.equal(431);

test/integration/subscriptions/request-events.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("Request initiated subscriptions", () => {
6464
'::ffff:127.0.0.1', // IPv4 localhost
6565
'::1' // IPv6 localhost
6666
]);
67-
expect(seenRequest.remotePort).to.be.greaterThan(32768);
67+
expect(seenRequest.remotePort).to.be.greaterThanOrEqual(32768);
6868
expect((seenRequest as any).body).to.equal(undefined); // No body included yet
6969

7070
const matchableHeaders = _.omit(seenRequest.headers, INCONSISTENT_HEADERS);
@@ -261,7 +261,7 @@ describe("Request subscriptions", () => {
261261
'::ffff:127.0.0.1', // IPv4 localhost
262262
'::1' // IPv6 localhost
263263
]);
264-
expect(seenRequest.remotePort).to.be.greaterThan(32768);
264+
expect(seenRequest.remotePort).to.be.greaterThanOrEqual(32768);
265265
expect(await seenRequest.body.getText()).to.equal('body-text');
266266
expect(seenRequest.tags).to.deep.equal([]);
267267
});

test/integration/subscriptions/tls-error-events.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe("TLS error subscriptions", () => {
9898
'::ffff:127.0.0.1', // IPv4 localhost
9999
'::1' // IPv6 localhost
100100
]);
101-
expect(tlsError.remotePort).to.be.greaterThan(32768);
101+
expect(tlsError.remotePort).to.be.greaterThanOrEqual(32768);
102102
expect(tlsError.tags).to.deep.equal([]);
103103

104104
expect(tlsError.timingEvents.startTime).to.be.greaterThan(0);
@@ -137,7 +137,7 @@ describe("TLS error subscriptions", () => {
137137
'::ffff:127.0.0.1', // IPv4 localhost
138138
'::1' // IPv6 localhost
139139
]);
140-
expect(tlsError.remotePort).to.be.greaterThan(32768);
140+
expect(tlsError.remotePort).to.be.greaterThanOrEqual(32768);
141141

142142
expect(tlsError.timingEvents.startTime).to.be.greaterThan(0);
143143
expect(tlsError.timingEvents.connectTimestamp).to.be.greaterThan(0);

0 commit comments

Comments
 (0)