globalTeardown 在本地工作但在 Kubernetes 工作负载上失败
globalTeardown works locally but fails on Kubernetes workload
我正在尝试 运行 在 kubernetes 上进行简单的开玩笑设置。到目前为止,它在我的本地工作站(WIN10 上的 WLS2)上运行良好。
问题:当我将 globalTeardown
添加到我的 package.json 时,该函数在我的 kubernetes 工作负载中失败,但在本地执行时有效。 运行 均由 npm run test
调用
kubernetes 工作负载的日志打印出这个错误:
[...] // Tests are executed as usual
Test Suites: 1 failed, 1 total
Tests: 2 failed, 1 passed, 3 total
Snapshots: 0 total
Time: 6.57s
reporter is created on: /opt/app/public/report.html
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe',
path: '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgAvAG8AcAB0AC8AYQBwAHAALwBwAHUAYgBsAGkAYwAvAHIAZQBwAG8AcgB0AC4AaAB0AG0AbAAiAA=='
]
}
我不知道如何将它连接到 Powershell,因为使用的图像基于 Ubuntu。会不会是使用集成到 WSL2 的 Rancher Desktop 造成的?
package.json
{
"name": "endpoint-testing",
"version": "1.0.0",
"description": "Test utility for testing endpoints of backends from a kubernetes cluster",
"main": "index.js",
"type": "module",
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --forceExit",
"watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
"run": "node --experimental-vm-modules index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.27.2",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"express-fileupload": "^1.3.1",
"form-data": "^4.0.0",
"jest": "^28.1.0",
"jest-html-reporter": "^3.5.0",
"jest-html-reporters": "^3.0.7",
"jest-standard-reporter": "^2.0.0",
"supertest": "^6.2.3",
"winston": "^3.7.2"
},
"jest": {
"globalSetup": "./tests/setup.js",
"globalTeardown": "./tests/customTeardown.js",
"reporters": [
"jest-standard-reporter",
[
"jest-html-reporters",
{
"publicPath": "./public",
"filename": "report.html",
"openReport": true,
"inlineSource": true
}
]
]
}
}
./tests/customTeardown.js
export default async function () {
console.log("Done");
};
更新:
我发现在使用 Kind 而不是 Rancher Desktop 时不会发生这种情况。所以这似乎是Rancher Desktop的集成问题。
我正在尝试 运行 在 kubernetes 上进行简单的开玩笑设置。到目前为止,它在我的本地工作站(WIN10 上的 WLS2)上运行良好。
问题:当我将 globalTeardown
添加到我的 package.json 时,该函数在我的 kubernetes 工作负载中失败,但在本地执行时有效。 运行 均由 npm run test
kubernetes 工作负载的日志打印出这个错误:
[...] // Tests are executed as usual
Test Suites: 1 failed, 1 total
Tests: 2 failed, 1 passed, 3 total
Snapshots: 0 total
Time: 6.57s
reporter is created on: /opt/app/public/report.html
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe',
path: '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgAvAG8AcAB0AC8AYQBwAHAALwBwAHUAYgBsAGkAYwAvAHIAZQBwAG8AcgB0AC4AaAB0AG0AbAAiAA=='
]
}
我不知道如何将它连接到 Powershell,因为使用的图像基于 Ubuntu。会不会是使用集成到 WSL2 的 Rancher Desktop 造成的?
package.json
{
"name": "endpoint-testing",
"version": "1.0.0",
"description": "Test utility for testing endpoints of backends from a kubernetes cluster",
"main": "index.js",
"type": "module",
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --forceExit",
"watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
"run": "node --experimental-vm-modules index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.27.2",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"express-fileupload": "^1.3.1",
"form-data": "^4.0.0",
"jest": "^28.1.0",
"jest-html-reporter": "^3.5.0",
"jest-html-reporters": "^3.0.7",
"jest-standard-reporter": "^2.0.0",
"supertest": "^6.2.3",
"winston": "^3.7.2"
},
"jest": {
"globalSetup": "./tests/setup.js",
"globalTeardown": "./tests/customTeardown.js",
"reporters": [
"jest-standard-reporter",
[
"jest-html-reporters",
{
"publicPath": "./public",
"filename": "report.html",
"openReport": true,
"inlineSource": true
}
]
]
}
}
./tests/customTeardown.js
export default async function () {
console.log("Done");
};
更新:
我发现在使用 Kind 而不是 Rancher Desktop 时不会发生这种情况。所以这似乎是Rancher Desktop的集成问题。