Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test coverage for Sidekiq job perform_inline #2836

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading