我在spec\u helper.rb中有以下配置
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
# Create indexes for all elastic searchable models
ApplicationRecord.descendants.each do |model|
if model.respond_to?(:__elasticsearch__)
elastic_error_wrapper("Creation of index", model.name) do
model.__elasticsearch__.create_index!(force: true)
model.__elasticsearch__.refresh_index!
end
end
end
load Rails.root + "db/seeds.rb"
end
config.after(:suite) do
# Delete indexes for all elastic searchable models to ensure clean state between tests
ApplicationRecord.descendants.each do |model|
if model.respond_to?(:__elasticsearch__)
elastic_error_wrapper("Removing the index", model.name) do
model.__elasticsearch__.delete_index!
end
end
end
end
当我跑耙子的时候parallel:spec
它给了我一个错误:
An error occurred in a `before(:suite)` hook.
Failure/Error: load Rails.root + "db/seeds.rb"
Faraday::TimeoutError:
Net::ReadTimeout
和
Elasticsearch::Transport::Transport::Errors::NotFound:
[404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [users_test]","index_uuid":"gexuxS9MQdS74RZwUVjpVg","index":"users_test"}],"type":"index_not_found_exception","reason":"no such index [users_test]","index_uuid":"gexuxS9MQdS74RZwUVjpVg","index":"users_test"},"status":404}
但是当我用http://localhost:9200/\u目录/索引。用户可以在其中找到一个测试
暂无答案!
目前还没有任何答案,快来回答吧!