Capybara-webkit、rspec 集成规范和 xvfb:webkit_server:致命 IO 错误:客户端被终止
我正在尝试使用 headless gem、xvfb 和 capybara-webkit 来获取在 ubuntu 服务器 CI 盒上运行的一套集成规范,以进行无头测试。一切在本地开发盒上都运行得很好,但一旦转移到 CI 服务器上,事情就会变得有趣。
在规范帮助器中,有一些代码包装:js 在无头块中启用了集成规范,如下所示:
config.around(:each, :js => true) do |example|
Headless.ly &example
end
就像我说的,这一切在本地开发盒上都能很好地工作。在 CI 上,它使用 headless gem 和 xvfb 作为同一用户对不同项目进行测试,当规范需要实例化浏览器实例时,尝试运行集成规范会导致以下错误:
webkit_server:致命 IO 错误:客户端被终止
我一直在试图找出可能导致该错误的原因,但甚至无法找到该错误可能来自何处的痕迹,或任何其他有助于调试问题的信息。
到目前为止,我已经检查/尝试了以下操作:
- CI 用户绝对有权运行 xvfb
- 运行“Xvfb :99 -ac”,因为 CI 用户给出了有关未找到字体的警告,没有其他问题
有谁知道可能会发生什么造成这种情况的原因,或者我可以在哪里查找更多信息?我对此很困惑。
谢谢!
I'm trying to get a suite of integration specs running on a ubuntu server CI box using the headless gem, xvfb, and capybara-webkit for headless testing. Everything works beautifully on a local dev box, but things get interesting once moved over to the CI server.
In the spec helper there is a bit of code wrapping :js enabled integration specs within a headless block like so:
config.around(:each, :js => true) do |example|
Headless.ly &example
end
Like I said, this all works nicely on a local dev box. On CI, which is using the headless gem and xvfb as the same user for tests for a different project, attempting to run the integration specs results in the following error when the spec would need to instantiate a browser instance:
webkit_server: Fatal IO error: client killed
I've been trying to figure out what could be causing that error, but can't even find a trace of where that might have come from, or any other information to help debug the issue.
So far I've checked/tried the following:
- CI user definitely has permissions to run xvfb
- Running "Xvfb :99 -ac" as the CI user gives one warning about a not found font, no other issues
Does anyone have any ideas what might be causing this, or where I could look for more info? I'm pretty stumped on this.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定这是否完全是正确的解决方案,但它似乎对我有用。而不是这样做:
像这样使用 Xvfb 运行命令,并删除 headless gem 的使用:
似乎有点错误,但它有效。
I'm not sure if this is entirely the right solution, but it seems to work for me. Instead of doing:
Run the command with Xvfb like so, and remove the use of the headless gem:
Seems a bit wrong, but it works.
对我来说以下工作有效。我不确定为什么缺少“-a”无法运行 xvfb。我的构建现在正在 ubuntu+jenkins CI 上运行 @javascript 测试
for me the following worked. I am not sure why missing "-a" fails to run xvfb. My build is running @javascript tests on ubuntu+jenkins CI now
不确定这是否相关(我使用的是 capybara-webkit 而不是 Headless gem),但在我的 ubuntu 实例(ec2 上的 ubuntu lucid)上我还需要运行:
授予 jenkins 帐户与 xvfb 对话的权限。请参阅: 无法连接到 X 服务器:0.0一个 Qt 应用程序
Not sure this is related (I was using capybara-webkit instead of the Headless gem) but on my ubuntu instance (ubuntu lucid on ec2) I also needed to run:
to give the jenkins account permission to talk to xvfb. See: Cannot connect to X server :0.0 with a Qt application