所有场景通过后 Cucumber 挂起
我有 jRuby on Rails 应用程序和一些黄瓜测试。
问题是,cucumber features
在执行所有步骤后挂起,直到我按 ctrl+c。有趣的是,只有当所有测试都通过时才会发生这种情况。
10 scenarios (10 passed)
116 steps (116 passed)
13m59.058s
-> hangs here
我尝试添加全局 at_exit
挂钩,它正在执行并且命令冻结。
这是我的捆绑列表
https://gist.github.com/37f2448055071bbbc636
我的临时解决方案是添加 at_exit
钩子,如下所示
at_exit do
exit! !($!.nil? || $!.is_a?(SystemExit) && $!.success?)
end
某些连接可能保持打开状态,数据未清理等,但它至少会以 CI 服务器使用的正确状态代码退出。
I have jRuby on Rails application with some cucumber tests.
Problem is that cucumber features
hangs after executing all steps until I press ctrl+c. Interesting that it only happens if all of the tests pass.
10 scenarios (10 passed)
116 steps (116 passed)
13m59.058s
-> hangs here
I've tried adding global at_exit
hook, it is being executed and than command freezes.
Here is my bundle list
https://gist.github.com/37f2448055071bbbc636
My temporary solution is to add at_exit
hook like this
at_exit do
exit! !($!.nil? || $!.is_a?(SystemExit) && $!.success?)
end
Some connections may be left opened, data not cleaned, etc. but it will at least exit with correct status code, which is used by CI server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我意识到这是一篇非常旧的帖子,但如果有人偶然发现这一点,请按照:
https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#exiting
如果您在之后添加
--exit
你的cucumber命令,测试完成后cucumber将退出。这至少对我有用。I realize this is a very old post, but in case anyone stumbles upon this, per:
https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#exiting
if you add
--exit
after your cucumber command, cucumber will exit when the test are finished. This is what worked for me at least.在我们的例子中,我们意识到当我们创建未正确退出的后台进程时,就会发生这种锁定。我们修复了这个问题,将
system()
调用替换为spawn()
调用,并终止 at_exit 挂钩中的所有子进程。In our case, we realized that this lock-up happens when we created background processes that weren't quitting properly. We fixed this be replacing
system()
calls withspawn()
ones, and killing any child processes in our at_exit hook.