airbrake 5.7.0 → 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/airbrake/delayed_job/plugin.rb +6 -4
- data/lib/airbrake/rack/context_filter.rb +1 -1
- data/lib/airbrake/resque/failure.rb +1 -1
- data/lib/airbrake/sidekiq/error_handler.rb +1 -1
- data/lib/airbrake/version.rb +1 -1
- data/spec/apps/rails/logs/32.log +213 -0
- data/spec/apps/rails/logs/40.log +894 -0
- data/spec/apps/rails/logs/41.log +452 -0
- data/spec/apps/rails/logs/42.log +3119 -0
- data/spec/integration/rails/rails_spec.rb +50 -5
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/sidekiq/error_handler_spec.rb +20 -5
- metadata +2 -2
@@ -169,13 +169,32 @@ RSpec.describe "Rails integration specs" do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
describe "Resque workers" do
|
172
|
-
|
173
|
-
|
172
|
+
context "when Airbrake is configured" do
|
173
|
+
it "reports exceptions occurring in Resque workers" do
|
174
|
+
with_resque { get '/resque' }
|
174
175
|
|
175
|
-
|
176
|
-
|
176
|
+
wait_for_a_request_with_body(
|
177
|
+
/"message":"resque\serror".*"params":{.*
|
177
178
|
"class":"BingoWorker","args":\["bango","bongo"\].*}/x
|
178
|
-
|
179
|
+
)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context "when Airbrake is not configured" do
|
184
|
+
it "doesn't report errors" do
|
185
|
+
allow(Airbrake).to receive(:build_notice).and_return(nil)
|
186
|
+
allow(Airbrake).to receive(:notify)
|
187
|
+
|
188
|
+
with_resque { get '/resque' }
|
189
|
+
|
190
|
+
wait_for(
|
191
|
+
a_request(:post, endpoint).
|
192
|
+
with(body: /"message":"resque error"/)
|
193
|
+
).not_to have_been_made
|
194
|
+
|
195
|
+
expect(Airbrake).to have_received(:build_notice)
|
196
|
+
expect(Airbrake).not_to have_received(:notify)
|
197
|
+
end
|
179
198
|
end
|
180
199
|
end
|
181
200
|
|
@@ -195,6 +214,32 @@ RSpec.describe "Rails integration specs" do
|
|
195
214
|
# elsewhere.
|
196
215
|
sleep 2
|
197
216
|
end
|
217
|
+
|
218
|
+
context "when Airbrake is not configured" do
|
219
|
+
it "doesn't report errors" do
|
220
|
+
allow(Airbrake).to receive(:build_notice).and_return(nil)
|
221
|
+
allow(Airbrake).to receive(:notify)
|
222
|
+
|
223
|
+
# Make sure we don't call `build_notice` more than 1 time. Rack
|
224
|
+
# integration will try to handle error 500 and we want to prevent
|
225
|
+
# that: https://github.com/airbrake/airbrake/pull/583
|
226
|
+
allow_any_instance_of(Airbrake::Rack::Middleware).to(
|
227
|
+
receive(:notify_airbrake).
|
228
|
+
and_return(nil)
|
229
|
+
)
|
230
|
+
|
231
|
+
get '/delayed_job'
|
232
|
+
sleep 2
|
233
|
+
|
234
|
+
wait_for(
|
235
|
+
a_request(:post, endpoint).
|
236
|
+
with(body: /"message":"delayed_job error"/)
|
237
|
+
).not_to have_been_made
|
238
|
+
|
239
|
+
expect(Airbrake).to have_received(:build_notice)
|
240
|
+
expect(Airbrake).not_to have_received(:notify)
|
241
|
+
end
|
242
|
+
end
|
198
243
|
end
|
199
244
|
|
200
245
|
describe "notice payload when a user is authenticated without Warden" do
|
data/spec/spec_helper.rb
CHANGED
@@ -14,20 +14,35 @@ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
|
|
14
14
|
wait_for(a_request(:post, endpoint).with(body: body)).to have_been_made.once
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
stub_request(:post, endpoint).to_return(status: 201, body: '{}')
|
19
|
-
end
|
20
|
-
|
21
|
-
it "sends a notice to Airbrake" do
|
17
|
+
def call_handler
|
22
18
|
handler = Sidekiq.error_handlers.last
|
23
19
|
handler.call(
|
24
20
|
AirbrakeTestError.new('sidekiq error'),
|
25
21
|
'class' => 'HardSidekiqWorker', 'args' => %w(bango bongo)
|
26
22
|
)
|
23
|
+
end
|
24
|
+
|
25
|
+
before do
|
26
|
+
stub_request(:post, endpoint).to_return(status: 201, body: '{}')
|
27
|
+
end
|
28
|
+
|
29
|
+
it "sends a notice to Airbrake" do
|
30
|
+
expect(call_handler).to be_a(Airbrake::Promise)
|
27
31
|
|
28
32
|
wait_for_a_request_with_body(/"message":"sidekiq\serror"/)
|
29
33
|
wait_for_a_request_with_body(/"params":{.*"args":\["bango","bongo"\]/)
|
30
34
|
wait_for_a_request_with_body(/"component":"sidekiq","action":"HardSidekiqWorker"/)
|
31
35
|
end
|
36
|
+
|
37
|
+
context "when Airbrake is not configured" do
|
38
|
+
it "returns nil" do
|
39
|
+
allow(Airbrake).to receive(:build_notice).and_return(nil)
|
40
|
+
allow(Airbrake).to receive(:notify)
|
41
|
+
|
42
|
+
expect(call_handler).to be_nil
|
43
|
+
expect(Airbrake).to have_received(:build_notice)
|
44
|
+
expect(Airbrake).not_to have_received(:notify)
|
45
|
+
end
|
46
|
+
end
|
32
47
|
end
|
33
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.7.
|
4
|
+
version: 5.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake-ruby
|