代码拉取完成,页面将自动刷新
Hi small_leek, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-ruby, and any of the maintainers: @small_leek , @木得感情的openEuler机器人 , @jiangxinyu
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
相关测试用例代码如下:
24 def test_db_checks_database_exists
25 ActiveRecord::Base.stub(:establish_connection, nil) do
26 assert_called_with(File, :exist?, [@database], returns: false) do
27 ActiveRecord::Tasks::DatabaseTasks.create @configuration, "/rails/root"
28 end
29 end
30 end
该测试用例为偶现失败。
测试过程activerecord通过rubygem-sqlite3客户端工具连接sqlite数据库,初始化database后使用assert_called_with()函数判断database是否存在,若不存在返回false。
可能导致异常的原因:执行测试用例为多线程方式,由于编译平台存在资源抢占,且sqlite3数据库在多线程操作时不稳定,创建数据库线程时未执行完,从而导致执行判断数据库是否存在时的用例失败。
登录 后才可以发表评论