2017-08-08 113 views
1

我開始接受Algolia :: AlgoliaProtocolError從1.17.0升級到1.19.1Algolia :: AlgoliaProtocolError在RSpec的寶石升級後

完整的堆棧跟蹤後下方。

Failure/Error: @listing = FactoryGirl.create :used_car_listing, user_id: another_user.id 

Algolia::AlgoliaProtocolError: 
    Cannot reach any host: getaddrinfo: nodename nor servname provided, or not known (XXX.algolia.net:443), getaddrinfo: nodename nor servname provided, or not known (XXX-3.algolianet.com:443), getaddrinfo: nodename nor servname provided, or not known (XXX-1.algolianet.com:443), getaddrinfo: nodename nor servname provided, or not known (XXX-2.algolianet.com:443) 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-1.12.7/lib/algolia/client.rb:365:in `request' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-1.12.7/lib/algolia/client.rb:377:in `put' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-1.12.7/lib/algolia/index.rb:431:in `set_settings' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:292:in `block (3 levels) in <class:SafeIndex>' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:327:in `log_or_throw' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:291:in `block (2 levels) in <class:SafeIndex>' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:750:in `algolia_ensure_init' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:552:in `block in algolia_index!' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:549:in `each' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:549:in `algolia_index!' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:893:in `algolia_index!' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:912:in `algolia_enqueue_index!' 
# /Users/****/.rvm/gems/[email protected]****/gems/algoliasearch-rails-1.19.1/lib/algoliasearch-rails.rb:942:in `algolia_perform_index_tasks' 
# ### REMOVED FOR BREVITY 
# /Users/****/.rvm/gems/[email protected]****/gems/factory_girl-4.5.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method' 
# ./spec/controllers/api/v1/images_controller_spec.rb:10:in `block (3 levels) in <top (required)>' 
+0

mmhan,這可能是由於配置。 Algolia索引正在開發中? 你想要測試什麼? – MatayoshiMariano

+0

你正試圖通過你的網絡無法訪問的服務器getaddrinfo:節點名或服務器名提供,或不知道(XXX.algolia.net:443),getaddrinfo:節點名或服務器名提供' – phoet

+0

@MatayoshiMariano Algolia的索引被禁用針對測試環境,因此測試用例在升級前正在工作。升級打破的唯一變化就是升級。 – mmhan

回答

0

據我所知,你已經設置XXX爲您Algolia的applicationID因爲你運行測試,你不希望他們調用實際API。不幸的是,看起來寶石試圖調用API,因此試圖聯繫XXX.algolia.net - >這是無法訪問...

你是在嘲笑調用(使用WebMock)或通過algoliasearch塊禁用索引?你能告訴我們更多關於如何在測試中「禁用」Algolia索引的內容嗎?

+0

我會停止在這裏重複我的評論。因爲我們已經在github @redox上互相交談過了 – mmhan