I'm having problems getting my specs to run cleanly on our CI server (Codeship).
The specs run fine locally but it seems that on the CI server elasticsearch is having issues keeping in sync.
I've researched this issue and have found potential solutions, but none of them work.
First solution I had, was creating a helper method for the test suite for whenever I needed to reindex.
def refresh_elasticsearch(model)
model.reindex
model.searchkick_index.refresh
end
Without this I was having local specs fail because documents were not being found. Once I started calling the helper method, everything started working.
I have 2 controllers that have elasticsearch functionality, and only one of them runs OK on Codeship, which is strange. These controllers are very similar to one another so I'm really confused why one controller spec passes ALL the time and the other one doesn't.
No exceptions are thrown, just some basic expectations that fail because I'm expecting a document and it finds none.
I've tried all these solutions as well: https://github.com/ankane/searchkick/pull/95
All these solutions work locally BTW. But they all fail for the same reason on the CI server.
I'm running out of things to try at this point. Any ideas??
Any help is appreciated. Thanks!!