3

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!!

Eugene Correia
  • 271
  • 2
  • 6
  • does adding a sleep before your expectations help? IIRC elasticsearch can take a little bit of time to bring newly indexed documents online – Thomas Walpole Jan 27 '16 at 21:57
  • I'm having the same problem in the same scenario but for me, I think it happens even in tests I'm not running any elasticsearch involved stuff. I do use elasticsearch all around my app, though, so I can't be 100% sure. Where you able to address the issue? – Erik Escobedo Dec 21 '16 at 16:02
  • 1
    I've also had trouble running elasticsearch on codeship. Their help articles haven't helped. Anyone find a solution to this? – Archonic Jul 28 '18 at 19:27

0 Answers0