Sha256: e11e8c78a8620bca973c89631ad689dbcb37d9bd9694d27e2296cc2d0560782b
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' describe Shoryuken::Middleware::Server::Timing do let(:queue) { 'default' } let(:sqs_queue) { double Shoryuken::Queue, visibility_timeout: 60 } let(:sqs_msg) do double Shoryuken::Message, queue_url: queue, body: 'test', message_id: 'fc754df7-9cc2-4c41-96ca-5996a44b771e' end before do allow(Shoryuken::Client).to receive(:queues).with(queue).and_return(sqs_queue) end it 'logs timing' do expect(Shoryuken.logger).to receive(:info).with(/started at/) expect(Shoryuken.logger).to receive(:info).with(/completed in/) subject.call(TestWorker.new, queue, sqs_msg, sqs_msg.body) {} end context 'when exceeded the `visibility_timeout`' do it 'logs exceeded' do allow(subject).to receive(:elapsed).and_return(120000) expect(Shoryuken.logger).to receive(:info).with(/started at/) expect(Shoryuken.logger).to receive(:info).with(/completed in/) expect(Shoryuken.logger).to receive(:warn).with('exceeded the queue visibility timeout by 60000 ms') subject.call(TestWorker.new, queue, sqs_msg, sqs_msg.body) {} end end context 'when exception' do it 'logs failed in' do expect(Shoryuken.logger).to receive(:info).with(/started at/) expect(Shoryuken.logger).to receive(:info).with(/failed in/) expect { subject.call(TestWorker.new, queue, sqs_msg, sqs_msg.body) { raise } }.to raise_error end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shoryuken-1.0.2 | spec/shoryuken/middleware/server/timing_spec.rb |
shoryuken-1.0.1 | spec/shoryuken/middleware/server/timing_spec.rb |