airbrake-ruby 6.1.0-java → 6.1.1-java

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +1 -1
  3. data/lib/airbrake-ruby/nested_exception.rb +10 -1
  4. data/lib/airbrake-ruby/notice.rb +5 -3
  5. data/lib/airbrake-ruby/version.rb +1 -1
  6. metadata +4 -122
  7. data/spec/airbrake_spec.rb +0 -522
  8. data/spec/async_sender_spec.rb +0 -65
  9. data/spec/backtrace_spec.rb +0 -430
  10. data/spec/benchmark_spec.rb +0 -35
  11. data/spec/code_hunk_spec.rb +0 -124
  12. data/spec/config/processor_spec.rb +0 -167
  13. data/spec/config/validator_spec.rb +0 -204
  14. data/spec/config_spec.rb +0 -188
  15. data/spec/context_spec.rb +0 -54
  16. data/spec/deploy_notifier_spec.rb +0 -50
  17. data/spec/file_cache_spec.rb +0 -35
  18. data/spec/filter_chain_spec.rb +0 -124
  19. data/spec/filters/context_filter_spec.rb +0 -32
  20. data/spec/filters/dependency_filter_spec.rb +0 -14
  21. data/spec/filters/exception_attributes_filter_spec.rb +0 -52
  22. data/spec/filters/gem_root_filter_spec.rb +0 -44
  23. data/spec/filters/git_last_checkout_filter_spec.rb +0 -61
  24. data/spec/filters/git_repository_filter_spec.rb +0 -72
  25. data/spec/filters/git_revision_filter_spec.rb +0 -126
  26. data/spec/filters/keys_allowlist_spec.rb +0 -204
  27. data/spec/filters/keys_blocklist_spec.rb +0 -242
  28. data/spec/filters/root_directory_filter_spec.rb +0 -39
  29. data/spec/filters/sql_filter_spec.rb +0 -274
  30. data/spec/filters/system_exit_filter_spec.rb +0 -16
  31. data/spec/filters/thread_filter_spec.rb +0 -281
  32. data/spec/fixtures/notroot.txt +0 -7
  33. data/spec/fixtures/project_root/code.rb +0 -221
  34. data/spec/fixtures/project_root/empty_file.rb +0 -0
  35. data/spec/fixtures/project_root/long_line.txt +0 -1
  36. data/spec/fixtures/project_root/short_file.rb +0 -3
  37. data/spec/fixtures/project_root/vendor/bundle/ignored_file.rb +0 -5
  38. data/spec/helpers.rb +0 -9
  39. data/spec/ignorable_spec.rb +0 -14
  40. data/spec/inspectable_spec.rb +0 -45
  41. data/spec/loggable_spec.rb +0 -17
  42. data/spec/monotonic_time_spec.rb +0 -25
  43. data/spec/nested_exception_spec.rb +0 -73
  44. data/spec/notice_notifier/options_spec.rb +0 -269
  45. data/spec/notice_notifier_spec.rb +0 -361
  46. data/spec/notice_spec.rb +0 -300
  47. data/spec/performance_breakdown_spec.rb +0 -11
  48. data/spec/performance_notifier_spec.rb +0 -645
  49. data/spec/promise_spec.rb +0 -203
  50. data/spec/query_spec.rb +0 -11
  51. data/spec/queue_spec.rb +0 -18
  52. data/spec/remote_settings/callback_spec.rb +0 -162
  53. data/spec/remote_settings/settings_data_spec.rb +0 -348
  54. data/spec/remote_settings_spec.rb +0 -201
  55. data/spec/request_spec.rb +0 -9
  56. data/spec/response_spec.rb +0 -110
  57. data/spec/spec_helper.rb +0 -100
  58. data/spec/stashable_spec.rb +0 -23
  59. data/spec/stat_spec.rb +0 -39
  60. data/spec/sync_sender_spec.rb +0 -168
  61. data/spec/tdigest_spec.rb +0 -235
  62. data/spec/thread_pool_spec.rb +0 -196
  63. data/spec/time_truncate_spec.rb +0 -30
  64. data/spec/timed_trace_spec.rb +0 -127
  65. data/spec/truncator_spec.rb +0 -267
@@ -1,522 +0,0 @@
1
- RSpec.describe Airbrake do
2
- let(:remote_settings) { instance_double(Airbrake::RemoteSettings) }
3
-
4
- before do
5
- allow(Airbrake::RemoteSettings).to receive(:poll).and_return(remote_settings)
6
- allow(remote_settings).to receive(:stop_polling)
7
- end
8
-
9
- after { described_class.instance_variable_set(:@remote_settings, nil) }
10
-
11
- it "gets initialized with a performance notifier" do
12
- expect(described_class.performance_notifier).not_to be_nil
13
- end
14
-
15
- it "gets initialized with a notice notifier" do
16
- expect(described_class.notice_notifier).not_to be_nil
17
- end
18
-
19
- it "gets initialized with a deploy notifier" do
20
- expect(described_class.deploy_notifier).not_to be_nil
21
- end
22
-
23
- describe ".configure" do
24
- before do
25
- Airbrake::Config.instance = Airbrake::Config.new
26
- described_class.reset
27
- end
28
-
29
- after { described_class.reset }
30
-
31
- it "yields the config" do
32
- expect do |b|
33
- described_class.configure(&b)
34
- rescue Airbrake::Error
35
- nil
36
- end.to yield_with_args(Airbrake::Config)
37
- end
38
-
39
- it "sets logger to Airbrake::Loggable" do
40
- logger = Logger.new(File::NULL)
41
- described_class.configure do |c|
42
- c.project_id = 1
43
- c.project_key = '123'
44
- c.logger = logger
45
- end
46
-
47
- expect(Airbrake::Loggable.instance).to eql(logger)
48
- end
49
-
50
- it "makes Airbrake configured" do
51
- expect(described_class).not_to be_configured
52
-
53
- described_class.configure do |c|
54
- c.project_id = 1
55
- c.project_key = '2'
56
- end
57
-
58
- expect(described_class).to be_configured
59
- end
60
-
61
- context "when called multiple times" do
62
- it "doesn't overwrite performance notifier" do
63
- described_class.configure { anything }
64
- performance_notifier = described_class.performance_notifier
65
-
66
- described_class.configure { anything }
67
- expect(described_class.performance_notifier).to eql(performance_notifier)
68
- end
69
-
70
- it "doesn't overwrite notice notifier" do
71
- described_class.configure { anything }
72
- notice_notifier = described_class.notice_notifier
73
-
74
- described_class.configure { anything }
75
- expect(described_class.notice_notifier).to eql(notice_notifier)
76
- end
77
-
78
- it "doesn't overwrite deploy notifier" do
79
- described_class.configure { anything }
80
- deploy_notifier = described_class.deploy_notifier
81
-
82
- described_class.configure { anything }
83
- expect(described_class.deploy_notifier).to eql(deploy_notifier)
84
- end
85
-
86
- it "doesn't append the same notice notifier filters over and over" do
87
- described_class.configure do |c|
88
- c.project_id = 1
89
- c.project_key = '2'
90
- end
91
-
92
- allow(described_class.notice_notifier).to receive(:add_filter)
93
-
94
- 10.times { described_class.configure { anything } }
95
-
96
- expect(described_class.notice_notifier).not_to have_received(:add_filter)
97
- end
98
-
99
- it "appends some default filters" do
100
- allow(described_class.notice_notifier).to receive(:add_filter)
101
-
102
- described_class.configure do |c|
103
- c.project_id = 1
104
- c.project_key = '2'
105
- end
106
-
107
- expect(described_class.notice_notifier).to have_received(:add_filter).with(
108
- an_instance_of(Airbrake::Filters::RootDirectoryFilter),
109
- )
110
- end
111
- end
112
-
113
- context "when blocklist_keys gets configured" do
114
- before { allow(described_class.notice_notifier).to receive(:add_filter) }
115
-
116
- it "adds blocklist filter" do
117
- allow(described_class.notice_notifier).to receive(:add_filter)
118
-
119
- described_class.configure { |c| c.blocklist_keys = %w[password] }
120
-
121
- expect(described_class.notice_notifier).to have_received(:add_filter)
122
- .with(an_instance_of(Airbrake::Filters::KeysBlocklist))
123
- end
124
-
125
- it "initializes blocklist with specified parameters" do
126
- allow(Airbrake::Filters::KeysBlocklist).to receive(:new)
127
-
128
- described_class.configure { |c| c.blocklist_keys = %w[password] }
129
-
130
- expect(Airbrake::Filters::KeysBlocklist)
131
- .to have_received(:new).with(%w[password])
132
- end
133
- end
134
-
135
- context "when allowlist_keys gets configured" do
136
- before { allow(described_class.notice_notifier).to receive(:add_filter) }
137
-
138
- it "adds allowlist filter" do
139
- described_class.configure { |c| c.allowlist_keys = %w[banana] }
140
- expect(described_class.notice_notifier).to have_received(:add_filter)
141
- .with(an_instance_of(Airbrake::Filters::KeysAllowlist))
142
- end
143
-
144
- it "initializes allowlist with specified parameters" do
145
- allow(Airbrake::Filters::KeysAllowlist).to receive(:new)
146
-
147
- described_class.configure { |c| c.allowlist_keys = %w[banana] }
148
- expect(Airbrake::Filters::KeysAllowlist)
149
- .to have_received(:new).with(%w[banana])
150
- end
151
- end
152
-
153
- context "when root_directory gets configured" do
154
- before { allow(described_class.notice_notifier).to receive(:add_filter) }
155
-
156
- it "adds root directory filter" do
157
- described_class.configure { |c| c.root_directory = '/my/path' }
158
-
159
- expect(described_class.notice_notifier).to have_received(:add_filter)
160
- .with(an_instance_of(Airbrake::Filters::RootDirectoryFilter))
161
- end
162
-
163
- it "initializes root directory filter with specified path" do
164
- allow(Airbrake::Filters::RootDirectoryFilter).to receive(:new)
165
- described_class.configure { |c| c.root_directory = '/my/path' }
166
-
167
- expect(Airbrake::Filters::RootDirectoryFilter)
168
- .to have_received(:new).with('/my/path')
169
- end
170
-
171
- it "adds git revision filter" do
172
- described_class.configure { |c| c.root_directory = '/my/path' }
173
- expect(described_class.notice_notifier).to have_received(:add_filter)
174
- .with(an_instance_of(Airbrake::Filters::GitRevisionFilter))
175
- end
176
-
177
- it "initializes git revision filter with correct root directory" do
178
- allow(Airbrake::Filters::GitRevisionFilter).to receive(:new)
179
- described_class.configure { |c| c.root_directory = '/my/path' }
180
-
181
- expect(Airbrake::Filters::GitRevisionFilter)
182
- .to have_received(:new).with('/my/path')
183
- end
184
-
185
- it "adds git repository filter" do
186
- described_class.configure { |c| c.root_directory = '/my/path' }
187
-
188
- expect(described_class.notice_notifier).to have_received(:add_filter)
189
- .with(an_instance_of(Airbrake::Filters::GitRepositoryFilter))
190
- end
191
-
192
- it "initializes git repository filter with correct root directory" do
193
- allow(Airbrake::Filters::GitRepositoryFilter).to receive(:new)
194
-
195
- described_class.configure { |c| c.root_directory = '/my/path' }
196
-
197
- expect(Airbrake::Filters::GitRepositoryFilter)
198
- .to have_received(:new).with('/my/path')
199
- end
200
-
201
- it "adds git last checkout filter" do
202
- described_class.configure { |c| c.root_directory = '/my/path' }
203
- expect(described_class.notice_notifier).to have_received(:add_filter)
204
- .with(an_instance_of(Airbrake::Filters::GitLastCheckoutFilter))
205
- end
206
-
207
- it "initializes git last checkout filter with correct root directory" do
208
- allow(Airbrake::Filters::GitLastCheckoutFilter).to receive(:new)
209
- described_class.configure { |c| c.root_directory = '/my/path' }
210
-
211
- expect(Airbrake::Filters::GitLastCheckoutFilter)
212
- .to have_received(:new).with('/my/path')
213
- end
214
- end
215
- end
216
-
217
- describe ".notify_request" do
218
- before do
219
- allow(described_class.performance_notifier).to receive(:notify)
220
- end
221
-
222
- context "when :stash key is not provided" do
223
- it "doesn't add anything to the stash of the request" do
224
- described_class.notify_request(
225
- method: 'GET',
226
- route: '/',
227
- status_code: 200,
228
- timing: 1,
229
- )
230
-
231
- expect(
232
- described_class.performance_notifier,
233
- ).to have_received(:notify) do |request|
234
- expect(request.stash).to be_empty
235
- end
236
- end
237
- end
238
-
239
- context "when :stash key is provided" do
240
- it "adds the value as the stash of the request" do
241
- described_class.notify_request(
242
- {
243
- method: 'GET',
244
- route: '/',
245
- status_code: 200,
246
- timing: 1,
247
- },
248
- request_id: 1,
249
- )
250
-
251
- expect(
252
- described_class.performance_notifier,
253
- ).to have_received(:notify) do |request|
254
- expect(request.stash).to eq(request_id: 1)
255
- end
256
- end
257
- end
258
- end
259
-
260
- describe ".notify_request_sync" do
261
- it "notifies request synchronously" do
262
- allow(described_class.performance_notifier).to receive(:notify_sync)
263
-
264
- described_class.notify_request_sync(
265
- {
266
- method: 'GET',
267
- route: '/',
268
- status_code: 200,
269
- timing: 1,
270
- },
271
- request_id: 1,
272
- )
273
-
274
- expect(described_class.performance_notifier).to have_received(:notify_sync)
275
- end
276
- end
277
-
278
- describe ".notify_query" do
279
- before do
280
- allow(described_class.performance_notifier).to receive(:notify)
281
- end
282
-
283
- context "when :stash key is not provided" do
284
- it "doesn't add anything to the stash of the query" do
285
- described_class.notify_query(
286
- method: 'GET',
287
- route: '/',
288
- query: '',
289
- timing: 1,
290
- )
291
-
292
- expect(
293
- described_class.performance_notifier,
294
- ).to have_received(:notify) do |query|
295
- expect(query.stash).to be_empty
296
- end
297
- end
298
- end
299
-
300
- context "when :stash key is provided" do
301
- it "adds the value as the stash of the query" do
302
- described_class.notify_query(
303
- {
304
- method: 'GET',
305
- route: '/',
306
- query: '',
307
- timing: 1,
308
- },
309
- request_id: 1,
310
- )
311
-
312
- expect(
313
- described_class.performance_notifier,
314
- ).to have_received(:notify) do |query|
315
- expect(query.stash).to eq(request_id: 1)
316
- end
317
- end
318
- end
319
- end
320
-
321
- describe ".notify_query_sync" do
322
- it "notifies query synchronously" do
323
- allow(described_class.performance_notifier).to receive(:notify_sync)
324
-
325
- described_class.notify_query_sync(
326
- {
327
- method: 'GET',
328
- route: '/',
329
- query: '',
330
- timing: 1,
331
- },
332
- request_id: 1,
333
- )
334
-
335
- expect(described_class.performance_notifier).to have_received(:notify_sync)
336
- end
337
- end
338
-
339
- describe ".notify_performance_breakdown" do
340
- before do
341
- allow(described_class.performance_notifier).to receive(:notify)
342
- end
343
-
344
- context "when :stash key is not provided" do
345
- it "doesn't add anything to the stash of the performance breakdown" do
346
- described_class.notify_query(
347
- method: 'GET',
348
- route: '/',
349
- query: '',
350
- timing: 1,
351
- )
352
-
353
- expect(
354
- described_class.performance_notifier,
355
- ).to have_received(:notify) do |query|
356
- expect(query.stash).to be_empty
357
- end
358
- end
359
- end
360
-
361
- context "when :stash key is provided" do
362
- it "adds the value as the stash of the performance breakdown" do
363
- described_class.notify_performance_breakdown(
364
- {
365
- method: 'GET',
366
- route: '/',
367
- response_type: :html,
368
- groups: {},
369
- timing: 1,
370
- },
371
- request_id: 1,
372
- )
373
-
374
- expect(
375
- described_class.performance_notifier,
376
- ).to have_received(:notify) do |performance_breakdown|
377
- expect(performance_breakdown.stash).to eq(request_id: 1)
378
- end
379
- end
380
- end
381
- end
382
-
383
- describe ".notify_performance_breakdown_sync" do
384
- it "notifies performance breakdown synchronously" do
385
- allow(described_class.performance_notifier).to receive(:notify_sync)
386
-
387
- described_class.notify_performance_breakdown_sync(
388
- {
389
- method: 'GET',
390
- route: '/',
391
- response_type: :html,
392
- groups: {},
393
- timing: 1,
394
- },
395
- request_id: 1,
396
- )
397
-
398
- expect(described_class.performance_notifier).to have_received(:notify_sync)
399
- end
400
- end
401
-
402
- describe ".notify_queue" do
403
- before do
404
- allow(described_class.performance_notifier).to receive(:notify)
405
- end
406
-
407
- context "when :stash key is not provided" do
408
- it "doesn't add anything to the stash of the queue" do
409
- described_class.notify_queue(
410
- queue: 'bananas',
411
- error_count: 10,
412
- )
413
-
414
- expect(
415
- described_class.performance_notifier,
416
- ).to have_received(:notify) do |queue|
417
- expect(queue.stash).to be_empty
418
- end
419
- end
420
- end
421
-
422
- context "when :stash key is provided" do
423
- it "adds the value as the stash of the queue" do
424
- described_class.notify_queue(
425
- {
426
- queue: 'bananas',
427
- error_count: 10,
428
- },
429
- request_id: 1,
430
- )
431
-
432
- expect(
433
- described_class.performance_notifier,
434
- ).to have_received(:notify) do |queue|
435
- expect(queue.stash).to eq(request_id: 1)
436
- end
437
- end
438
- end
439
- end
440
-
441
- describe ".notify_queue_sync" do
442
- it "notifies queue synchronously" do
443
- allow(described_class.performance_notifier).to receive(:notify_sync)
444
-
445
- described_class.notify_queue_sync(
446
- {
447
- queue: 'bananas',
448
- error_count: 10,
449
- },
450
- request_id: 1,
451
- )
452
-
453
- expect(described_class.performance_notifier).to have_received(:notify_sync)
454
- end
455
- end
456
-
457
- describe ".performance_notifier" do
458
- it "returns a performance notifier" do
459
- expect(described_class.performance_notifier)
460
- .to be_an(Airbrake::PerformanceNotifier)
461
- end
462
- end
463
-
464
- describe ".notice_notifier" do
465
- it "returns a notice notifier" do
466
- expect(described_class.notice_notifier).to be_an(Airbrake::NoticeNotifier)
467
- end
468
- end
469
-
470
- describe ".deploy_notifier" do
471
- it "returns a deploy notifier" do
472
- expect(described_class.deploy_notifier).to be_an(Airbrake::DeployNotifier)
473
- end
474
- end
475
-
476
- # rubocop:disable RSpec/MessageSpies
477
- describe ".close" do
478
- after { described_class.reset }
479
-
480
- context "when notice_notifier is defined" do
481
- it "gets closed" do
482
- expect(described_class.notice_notifier).to receive(:close)
483
- end
484
- end
485
-
486
- context "when notice_notifier is undefined" do
487
- it "doesn't get closed (because it wasn't initialized)" do
488
- described_class.instance_variable_set(:@notice_notifier, nil)
489
- expect_any_instance_of(Airbrake::NoticeNotifier).not_to receive(:close)
490
- end
491
- end
492
-
493
- context "when performance_notifier is defined" do
494
- it "gets closed" do
495
- expect(described_class.performance_notifier).to receive(:close)
496
- end
497
- end
498
-
499
- context "when perforance_notifier is undefined" do
500
- it "doesn't get closed (because it wasn't initialized)" do
501
- described_class.instance_variable_set(:@performance_notifier, nil)
502
- expect_any_instance_of(Airbrake::PerformanceNotifier)
503
- .not_to receive(:close)
504
- end
505
- end
506
-
507
- context "when remote settings are defined" do
508
- it "stops polling" do
509
- described_class.instance_variable_set(:@remote_settings, remote_settings)
510
- expect(remote_settings).to receive(:stop_polling)
511
- end
512
- end
513
-
514
- context "when remote settings are undefined" do
515
- it "doesn't stop polling (because they weren't initialized)" do
516
- described_class.instance_variable_set(:@remote_settings, nil)
517
- expect(remote_settings).not_to receive(:stop_polling)
518
- end
519
- end
520
- end
521
- # rubocop:enable RSpec/MessageSpies
522
- end
@@ -1,65 +0,0 @@
1
- RSpec.describe Airbrake::AsyncSender do
2
- let(:endpoint) { 'https://api.airbrake.io/api/v3/projects/1/notices' }
3
- let(:queue_size) { 10 }
4
- let(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
5
-
6
- before do
7
- stub_request(:post, endpoint).to_return(status: 201, body: '{}')
8
- Airbrake::Config.instance = Airbrake::Config.new(
9
- project_id: '1',
10
- workers: 3,
11
- queue_size: 10,
12
- )
13
- end
14
-
15
- describe "#send" do
16
- subject(:async_sender) { described_class.new }
17
-
18
- context "when sender has the capacity to send" do
19
- it "sends notices to Airbrake" do
20
- 2.times { async_sender.send(notice, Airbrake::Promise.new) }
21
- async_sender.close
22
-
23
- expect(a_request(:post, endpoint)).to have_been_made.twice
24
- end
25
-
26
- it "returns a resolved promise" do
27
- promise = Airbrake::Promise.new
28
- async_sender.send(notice, promise)
29
- async_sender.close
30
-
31
- expect(promise).to be_resolved
32
- end
33
- end
34
-
35
- context "when sender has exceeded the capacity to send" do
36
- before do
37
- Airbrake::Config.instance = Airbrake::Config.new(
38
- project_id: '1',
39
- workers: 0,
40
- queue_size: 1,
41
- )
42
- end
43
-
44
- it "doesn't send the exceeded notices to Airbrake" do
45
- 15.times { async_sender.send(notice, Airbrake::Promise.new) }
46
- async_sender.close
47
-
48
- expect(a_request(:post, endpoint)).not_to have_been_made
49
- end
50
-
51
- it "returns a rejected promise" do
52
- promise = nil
53
- 15.times do
54
- promise = async_sender.send(notice, Airbrake::Promise.new)
55
- end
56
- async_sender.close
57
-
58
- expect(promise).to be_rejected
59
- expect(promise.value).to eq(
60
- 'error' => "AsyncSender has reached its capacity of 1",
61
- )
62
- end
63
- end
64
- end
65
- end