2013-08-20 92 views
1

在工作中,我們有大約1500測試案例,我們使用DB.recreate手動清理數據庫!方法在每次測試之前。當使用bundle exec rake spec運行所有測試時,所有測試都很少通過。 「Errno :: ECONNREFUSED連接被拒絕 - 連接(2)錯誤」錯誤導致套件末尾有多個測試失敗。的CouchDB/Couchrest變量Errno :: ECONNREFUSED連接被拒絕 - (2)連接錯誤

任何幫助將不勝感激!

我使用CouchDB的1.3.1,Ubuntu的LTS 12.04,紅寶石1.9.3,和Rails 3.2.12。

感謝,

編輯

我更仔細地看了一下日誌文件和匹配CouchDB中日誌生成的測試失敗的開始時間和錯誤消息。

[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.23790.0>] ** Generic server <0.23790.0> terminating 
** Last message in was {'EXIT',<0.23789.0>,killed} 
** When Server state == {file,{file_descriptor,prim_file,{#Port<0.14445>,20}}, 
           79} 
** Reason for termination == 
** killed 

[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.23790.0>] {error_report,<0.31.0>, 
          {<0.23790.0>,crash_report, 
          [[{initial_call,{couch_file,init,['Argument__1']}}, 
          {pid,<0.23790.0>}, 
          {registered_name,[]}, 
          {error_info, 
           {exit,killed, 
            [{gen_server,terminate,6}, 
             {proc_lib,init_p_do_apply,3}]}}, 
          {ancestors,[<0.23789.0>]}, 
          {messages,[]}, 
          {links,[]}, 
          {dictionary,[]}, 
          {trap_exit,true}, 
          {status,running}, 
          {heap_size,377}, 
          {stack_size,24}, 
          {reductions,916}], 
          []]}} 
[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.23808.0>] {error_report,<0.31.0>, 
         {<0.23808.0>,crash_report, 
         [[{initial_call, 
          {couch_ref_counter,init,['Argument__1']}}, 
          {pid,<0.23808.0>}, 
          {registered_name,[]}, 
          {error_info, 
          {exit, 
          {noproc, 
          [{erlang,link,[<0.23790.0>]}, 
           {couch_ref_counter,'-init/1-lc$^0/1-0-',1}, 
           {couch_ref_counter,init,1}, 
           {gen_server,init_it,6}, 
           {proc_lib,init_p_do_apply,3}]}, 
          [{gen_server,init_it,6}, 
          {proc_lib,init_p_do_apply,3}]}}, 
          {ancestors,[<0.23793.0>,<0.23792.0>,<0.23789.0>]}, 
          {messages,[]}, 
          {links,[]}, 
          {dictionary,[]}, 
          {trap_exit,false}, 
          {status,running}, 
          {heap_size,377}, 
          {stack_size,24}, 
          {reductions,114}], 
         []]}} 
[Fri, 16 Aug 2013 19:39:46 GMT] [error] [<0.103.0>] ** Generic server <0.103.0> terminating 
** Last message in was {'EXIT',<0.88.0>,killed} 
** When Server state == {db,<0.103.0>,<0.104.0>,nil,<<"1376681645837889">>, 
          <0.106.0>,<0.102.0>,<0.107.0>, 
          {db_header,6,1,0, 
           {1856,{1,0,1777},95}, 
           {1951,1,83}, 
           nil,0,nil,nil,1000}, 
          1, 
          {btree,<0.102.0>, 
           {1856,{1,0,1777},95}, 
           #Fun<couch_db_updater.10.55895019>, 
           #Fun<couch_db_updater.11.100913286>, 
           #Fun<couch_btree.5.25288484>, 
           #Fun<couch_db_updater.12.39068440>,snappy}, 
          {btree,<0.102.0>, 
           {1951,1,83}, 
           #Fun<couch_db_updater.13.114276184>, 
           #Fun<couch_db_updater.14.2340873>, 
           #Fun<couch_btree.5.25288484>, 
           #Fun<couch_db_updater.15.23651859>,snappy}, 
          {btree,<0.102.0>,nil, 
           #Fun<couch_btree.3.20686015>, 
           #Fun<couch_btree.4.73514747>, 
           #Fun<couch_btree.5.25288484>,nil,snappy}, 
          1,<<"_users">>,"/var/lib/couchdb/_users.couch", 
          [#Fun<couch_doc.8.106888048>], 
          [],nil, 
          {user_ctx,null,[],undefined}, 
          nil,1000, 
          [before_header,after_header,on_file_open], 
          [create, 
          {before_doc_update, 
           #Fun<couch_users_db.before_doc_update.2>}, 
          {after_doc_read, 
           #Fun<couch_users_db.after_doc_read.2>}, 
          sys_db, 
          {user_ctx, 
           {user_ctx,null,[<<"_admin">>],undefined}}, 
          nologifmissing,sys_db], 
          snappy,#Fun<couch_users_db.before_doc_update.2>, 
          #Fun<couch_users_db.after_doc_read.2>} 
** Reason for termination == 
** killed 

回答

2

啊....社區的力量。我從CouchDB郵件列表中的某人處得到以下答案。

總之,解決方案是delayed_commit值更改爲false。它被設置爲true默認情況下,並迅速重建在每個測試用例的開頭多個數據庫正在創建一個競爭條件(刪除不存在的數據庫,等等)。

這無疑解決了我的問題。

一個需要注意的是,它已經翻倍了測試時間。這是另一個需要解決的問題,但現在,我對所有通過的測試感到滿意。

相關問題