我试图使用Chimp在Fargate上运行我的测试用例,Chimp内部使用了Webdriver.io / Selenium。当我在我的EC2实例上运行它们时,它们在我的docker容器中运行得很好,但是只要我将容器上传到ECS并尝试使用Fargate执行相同的测试,我就会收到以下错误:
Chimp version: 0.50.2
ChromeDriver version: ChromeDriver 2.34.522913 (36222509aa6e819815938cbf2709b4849735537c)
Java version: openjdk version "1.8.0_151", OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12), OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
Selenium version: 3.8.1
Selenium drivers version: chrome: 2.34, ie: 2.50.0, firefox: 0.19.1
OS version: Linux 4.9.62-21.56.amzn1.x86_64
Node version: v6.11.5
Browser version: chrome undefined
[33m
[chimp] Running...[39m
[chimp][helper] setupBrowserAndDDP had error
{ Error: unknown error: Chrome failed to start: exited abnormally
at initBrowser (node_modules/chimp/dist/lib/chimp-helper.js:189:43)
at Object.setupBrowserAndDDP (node_modules/chimp/dist/lib/chimp-helper.js:264:7)
at node_modules/chimp/dist/lib/cucumberjs/hooks.js:22:24
at node_modules/meteor-promise/fiber_pool.js:43:40
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)
at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:313:39)
at Request.self.callback (node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:128:9)
details: undefined,
message: 'unknown error: Chrome failed to start: exited abnormally\n (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)',
type: 'RuntimeError',
seleniumStack:
{ type: 'UnknownError',
message: 'An unknown server-side error occurred while processing the command.',
orgStatusMessage: 'unknown error: Chrome failed to start: exited abnormally\n (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)' } }
Error: unknown error: Chrome failed to start: exited abnormally
at initBrowser (node_modules/chimp/dist/lib/chimp-helper.js:189:43)
at Object.setupBrowserAndDDP (node_modules/chimp/dist/lib/chimp-helper.js:264:7)
at node_modules/chimp/dist/lib/cucumberjs/hooks.js:22:24
at node_modules/meteor-promise/fiber_pool.js:43:40
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.9.62-21.56.amzn1.x86_64 x86_64)
at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:144:12)
at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:313:39)
at Request.self.callback (node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:128:9)
Cucumber steps failed
我已尝试在测试脚本的开头添加以下行,以确保Chrome存在且响应:
echo Running chrome version:
google-chrome --version
结果是:
Running chrome version:
Google Chrome 62.0.3202.75
所以Chrome就在那里并做出回应。为什么它在Fargate中不起作用?
一开始的Chimp调试信息中的以下调试行看起来像是最大的罪魁祸首:
Browser version: chrome undefined
我不知道它为什么找不到它。当我在本地运行时,它会报告正确的版本。
答案 0 :(得分:1)
如果没有Headless Chrome,您也可以尝试使用Xvfb作为帧缓冲,因为 - 无头模式不适用于您的应用程序(这似乎是一个经常发生的事件)。
答案 1 :(得分:0)
很长一段时间后,我了解到我的docker容器在保存图像之前还没有成功完成所有操作。当我解决这个问题时,这个问题就消失了。 X11在Docker容器/ AWS Fargate中运行良好。