1 year ago

#384028

test-img

MJCune

Index deleted randomly on Rspec spec during CircleCI job

During execution time of specs on a job from CircleCI an index from Elasticsearch is either randomly deleted or not created throwing the following error:

Failure/Error: build_query.segment(:access_date, type: :terms).total.map { |k, v| [k[:access_date], v] }

    Elasticsearch::Transport::Transport::Errors::NotFound:
      [404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"test_access_log_index","index_uuid":"_na_","index":"test_access_log_index"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"test_access_log_index","index_uuid":"_na_","index":"test_access_log_index"},"status":404}
    ./app/services/access_log_search_service.rb:24:in `histogram'
    ./app/controllers/api/v3/access_performance_controller.rb:14:in `daily'
    ./lib/ksec/gcontroller.rb:14:in `wrap_store_controller'
    ./spec/controllers/api/v3/access_performance_controller_spec.rb:15:in `block (3 levels) in <top (required)>'
  • Rails 4.2.11.1
  • Ruby 2.5.7
  • Elastisearch 2.4
  • gem 'rspec-rails', '~> 3.8.2'
  • gem 'elastic-rails', '~> 1.0.2'
  • gem 'rspec-rails', '~> 3.8.2'e

So this is happening randomly maybe 2/20 times proportion a build is triggered, I haven't seen a pattern of why it is happening on logs, elastic-rails gem is included and I understand it should create indexes as needed automatically before Rspec execution. I already tried to force indexes creation on spec_helper.rb but I got more errors about missing indexes I think because it's causing conflicts as it's creating those indexes out of time.

Someone's had some related situation? or some clue to fix the issue?

Thanks in advance!

ruby-on-rails

ruby

elasticsearch

rspec

0 Answers

Your Answer

Accepted video resources