Skip to content

Commit

Permalink
Merge pull request #2836 from newrelic/sidekiq_inline
Browse files Browse the repository at this point in the history
Add unit test coverage for Sidekiq job `perform_inline`
  • Loading branch information
fallwith authored Sep 3, 2024
2 parents ef2c632 + 9eea9df commit 41430b2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,21 @@ def test_captures_sidekiq_internal_errors
assert_equal 1, noticed.size
assert_equal exception, noticed.first
end

# Sidekiq::Job::Setter#perform_inline is expected to light up all registered
# client and server middleware, and the lighting up of NR's server middleware
# will produce a segment
def test_works_with_perform_inline
# Sidekiq version 6.4.2 ends up invoking String#constantize, which is only
# delivered by ActiveSupport, which this test suite doesn't currently
# include.
skip 'This test requires Sidekiq v7+' unless Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.0.0')

in_transaction do |txn|
NRDeadEndJob.perform_inline
segments = txn.segments.select { |s| s.name.eql?('Nested/OtherTransaction/SidekiqJob/NRDeadEndJob/perform') }

assert_equal 1, segments.size, "Expected to find a single Sidekiq job segment, found #{segments.size}"
end
end
end

0 comments on commit 41430b2

Please sign in to comment.