Skip to content

Commit 9791e56

Browse files
committed
Ensure that tests pass on Active Support 6.1
1 parent b8c0fca commit 9791e56

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

instrumentation/active_support/test/opentelemetry/instrumentation/active_support/span_subscriber_test.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def finish(name, id, payload)
201201

202202
describe 'instrument' do
203203
after do
204-
ActiveSupport::Notifications.notifier.all_listeners_for(notification_name).each do |listener|
204+
ActiveSupport::Notifications.notifier.listeners_for(notification_name).each do |listener|
205205
ActiveSupport::Notifications.unsubscribe(listener)
206206
end
207207
end
@@ -396,6 +396,12 @@ def finish(name, id, payload)
396396
end
397397

398398
it 'finishes spans even when block subscribers blow up' do
399+
# This scenario cannot be exercised reliably on Active Support < 7.0 since the #finish method
400+
# will never be called by the notifier if another subscriber raises an error.
401+
#
402+
# See this PR for additional details: https://github.com/rails/rails/pull/43282
403+
skip 'Active Support Notifications will break in these scenarions in Rails < 7.0' if ActiveSupport.version < Gem::Version.new("7.0")
404+
399405
ActiveSupport::Notifications.subscribe(notification_pattern) { raise 'boom' }
400406
OpenTelemetry::Instrumentation::ActiveSupport.subscribe(tracer, notification_pattern)
401407

@@ -409,6 +415,12 @@ def finish(name, id, payload)
409415
end
410416

411417
it 'finishes spans even when complex subscribers blow up' do
418+
# This scenario cannot be exercised reliably on Active Support < 7.0 since the #finish method
419+
# will never be called by the notifier if another subscriber raises an error.
420+
#
421+
# See this PR for additional details: https://github.com/rails/rails/pull/43282
422+
skip 'Active Support Notifications will break in these scenarions in Rails < 7.0' if ActiveSupport.version < Gem::Version.new("7.0")
423+
412424
ActiveSupport::Notifications.subscribe(notification_pattern, CrashingEndSubscriber.new)
413425
OpenTelemetry::Instrumentation::ActiveSupport.subscribe(tracer, notification_pattern)
414426

0 commit comments

Comments
 (0)