fix the _a.destroy test flakiness

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-06-19 14:44:35 +02:00
parent 96be5d14d8
commit 7652db4b94
6 changed files with 8 additions and 114 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Only bootstrap global-agent if it's actually being used
+1 -26
View File
@@ -150,32 +150,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version:
[
18.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
20.x,
]
node-version: [18.x, 20.x]
name: Test ${{ matrix.node-version }}
services:
@@ -1,18 +0,0 @@
diff --git a/lib/interceptors/ClientRequest/NodeClientRequest.js b/lib/interceptors/ClientRequest/NodeClientRequest.js
index 9bcc5a6adfd3c84541d686c3d0039f5e79dd34f5..f72d47b02a437eaefead4ec1543a0dd70dd1bb6f 100644
--- a/lib/interceptors/ClientRequest/NodeClientRequest.js
+++ b/lib/interceptors/ClientRequest/NodeClientRequest.js
@@ -382,6 +382,13 @@ var NodeClientRequest = /** @class */ (function (_super) {
*/
NodeClientRequest.prototype.terminate = function () {
var _a;
+ const tempAgent = this.agent;
+ if (tempAgent && typeof tempAgent === 'object' && typeof tempAgent.destroy !== 'function') {
+ console.log(
+ `No agent to destroy, found '${typeof tempAgent}'->'${typeof tempAgent.destroy}':`,
+ tempAgent
+ );
+ }
// @ts-ignore
(_a = this.agent) === null || _a === void 0 ? void 0 : _a.destroy();
};
@@ -1,36 +0,0 @@
diff --git a/lib/node/chunk-CVV3L375.mjs b/lib/node/chunk-CVV3L375.mjs
index c37d61d709235efebe4ea19703a901bfbc05c9e3..4085c9b33075e18f7e4e3ad82fdd3fa5f6bb31e2 100644
--- a/lib/node/chunk-CVV3L375.mjs
+++ b/lib/node/chunk-CVV3L375.mjs
@@ -540,6 +540,13 @@ var _NodeClientRequest = class extends ClientRequest {
* Terminates a pending request.
*/
terminate() {
+ const tempAgent = this.agent;
+ if (tempAgent && typeof tempAgent === 'object' && typeof tempAgent.destroy !== 'function') {
+ console.log(
+ `No agent to destroy, found '${typeof tempAgent}'->'${typeof tempAgent.destroy}':`,
+ tempAgent
+ );
+ }
var _a;
(_a = this.agent) == null ? void 0 : _a.destroy();
}
diff --git a/lib/node/chunk-SXGRMPXP.js b/lib/node/chunk-SXGRMPXP.js
index a5129f18a9b754acf2bfb3b1545df2378b01a95a..8228b6d4f649937559f45aefbdb8c8df275c5285 100644
--- a/lib/node/chunk-SXGRMPXP.js
+++ b/lib/node/chunk-SXGRMPXP.js
@@ -540,6 +540,13 @@ var _NodeClientRequest = class extends _http.ClientRequest {
* Terminates a pending request.
*/
terminate() {
+ const tempAgent = this.agent;
+ if (tempAgent && typeof tempAgent === 'object' && typeof tempAgent.destroy !== 'function') {
+ console.log(
+ `No agent to destroy, found '${typeof tempAgent}'->'${typeof tempAgent.destroy}':`,
+ tempAgent
+ );
+ }
var _a;
(_a = this.agent) == null ? void 0 : _a.destroy();
}
-2
View File
@@ -87,8 +87,6 @@
"@changesets/assemble-release-plan@^6.0.0": "patch:@changesets/assemble-release-plan@npm%3A6.0.0#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.0-f7b3005037.patch",
"@material-ui/pickers@^3.2.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
"@material-ui/pickers@^3.3.10": "patch:@material-ui/pickers@npm%3A3.3.11#./.yarn/patches/@material-ui-pickers-npm-3.3.11-1c8f68ea20.patch",
"@mswjs/interceptors@^0.17.10": "patch:@mswjs/interceptors@npm%3A0.17.10#.yarn/patches/@mswjs-interceptors-npm-0.17.10-c1199a9424.patch",
"@mswjs/interceptors@^0.29.0": "patch:@mswjs/interceptors@npm%3A0.29.1#./.yarn/patches/@mswjs-interceptors-npm-0.29.1-b5be72ad54.patch",
"@types/react": "^18",
"@types/react-dom": "^18",
"jest-haste-map@^29.7.0": "patch:jest-haste-map@npm%3A29.7.0#./.yarn/patches/jest-haste-map-npm-29.7.0-e3be419eff.patch"
+2 -32
View File
@@ -10782,7 +10782,7 @@ __metadata:
languageName: node
linkType: hard
"@mswjs/interceptors@npm:0.17.10":
"@mswjs/interceptors@npm:^0.17.10":
version: 0.17.10
resolution: "@mswjs/interceptors@npm:0.17.10"
dependencies:
@@ -10798,7 +10798,7 @@ __metadata:
languageName: node
linkType: hard
"@mswjs/interceptors@npm:0.29.1":
"@mswjs/interceptors@npm:^0.29.0":
version: 0.29.1
resolution: "@mswjs/interceptors@npm:0.29.1"
dependencies:
@@ -10812,36 +10812,6 @@ __metadata:
languageName: node
linkType: hard
"@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.17.10#.yarn/patches/@mswjs-interceptors-npm-0.17.10-c1199a9424.patch::locator=root%40workspace%3A.":
version: 0.17.10
resolution: "@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.17.10#.yarn/patches/@mswjs-interceptors-npm-0.17.10-c1199a9424.patch::version=0.17.10&hash=652df3&locator=root%40workspace%3A."
dependencies:
"@open-draft/until": ^1.0.3
"@types/debug": ^4.1.7
"@xmldom/xmldom": ^0.8.3
debug: ^4.3.3
headers-polyfill: 3.2.5
outvariant: ^1.2.1
strict-event-emitter: ^0.2.4
web-encoding: ^1.1.5
checksum: 32ca2f2d4e8bc46e1f773ca440a0ec5ba9c69ea4d89c07fbd25a0fde73627a232eb7d0cf3ce426fbe1fd58863ab9c84386352ecdc55eeb2a5240ba126c0ba6f0
languageName: node
linkType: hard
"@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.29.1#./.yarn/patches/@mswjs-interceptors-npm-0.29.1-b5be72ad54.patch::locator=root%40workspace%3A.":
version: 0.29.1
resolution: "@mswjs/interceptors@patch:@mswjs/interceptors@npm%3A0.29.1#./.yarn/patches/@mswjs-interceptors-npm-0.29.1-b5be72ad54.patch::version=0.29.1&hash=d6ea98&locator=root%40workspace%3A."
dependencies:
"@open-draft/deferred-promise": ^2.2.0
"@open-draft/logger": ^0.3.0
"@open-draft/until": ^2.0.0
is-node-process: ^1.2.0
outvariant: ^1.2.1
strict-event-emitter: ^0.5.1
checksum: d7ce191736c8b5df2dcdb36d11dbf25ca37cd3c0d1319cf8594713c443c5bdf733c2aeb4863aba646a67b50813e64dc1b13fbd31cee238cc4c9f8a8fd2908486
languageName: node
linkType: hard
"@mui/base@npm:5.0.0-beta.40":
version: 5.0.0-beta.40
resolution: "@mui/base@npm:5.0.0-beta.40"