Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Redis::CannotConnectError in sidekiq rspec test cases

$
0
0

I have written sidekiq test cases for retries block and its been there for almost a year now, but suddenly it started throwing redis error, not sure what is wrong, could someone please help me here.

Test cases:worker_spec.rb

context "retries exhaust" do      it "should retry" do        msg = {"retry"=>1, "queue"=>"default", "args" => ""}        LeadWorker.within_sidekiq_retries_exhausted_block(msg) {          expect(Sidekiq.logger).to receive(:warn).at_least(:once)        }      end    end

worker.rb

sidekiq_retries_exhausted do |msg|    Sidekiq.logger.warn "Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}"    #Recording to NewRelic    failed_jobs = Sidekiq::Stats.new.failed    ::NewRelic::Agent.record_metric('Custom/Sidekiq/FailedQueue', failed_jobs)  end

In local test cases are running properly, but when i push changes in Jenkins its failing, error is below

LeadWorker perform retries exhaust should retry     Failure/Error: failed_jobs = Sidekiq::Stats.new.failed     Redis::CannotConnectError:       getaddrinfo: Name or service not known...

Its throwing error for Sidekiq::Stats.new.failed, but not sure why suddenly my code is not working.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>