Skip to content

Commit

Permalink
Add unit test for callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
kitop committed Jul 11, 2018
1 parent 442d242 commit 4df99f4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/ddtrace/workers_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

RSpec.describe Datadog::Workers::AsyncTransport do
describe 'callbacks' do
describe 'when raising errors' do
it 'does not re-raise' do
buf = StringIO.new
Datadog::Tracer.log = Datadog::Logger.new(buf)
task = proc { raise StandardError }
worker = Datadog::Workers::AsyncTransport.new(nil, 100, task, task, 0.5)

worker.enqueue_trace(get_test_traces(1))
worker.enqueue_service(get_test_services)

expect { worker.callback_traces }.to_not raise_error
expect { worker.callback_services }.to_not raise_error

lines = buf.string.lines
expect(lines.length).to eq 2
end
end
end
end

0 comments on commit 4df99f4

Please sign in to comment.