Skip to content

Commit 44cda99

Browse files
committed
fix: tests work with empty array of links
1 parent a7c5536 commit 44cda99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

instrumentation/sidekiq/test/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
_(root_span.kind).must_equal :producer
134134

135135
# process span is linked to the root enqueuing job
136-
child_span1 = spans.find { |s| s.links && s.links.first.span_context.span_id == root_span.span_id }
136+
child_span1 = spans.find { |s| s.links&.first&.span_context&.span_id == root_span.span_id }
137137
_(child_span1.name).must_equal 'default process'
138138
_(child_span1.kind).must_equal :consumer
139139

@@ -143,7 +143,7 @@
143143
_(child_span2.kind).must_equal :producer
144144

145145
# last process job is linked back to the process job that enqueued it
146-
child_span3 = spans.find { |s| s.links && s.links.first.span_context.span_id == child_span2.span_id }
146+
child_span3 = spans.find { |s| s.links&.first&.span_context&.span_id == child_span2.span_id }
147147
_(child_span3.name).must_equal 'default process'
148148
_(child_span3.kind).must_equal :consumer
149149
end

0 commit comments

Comments
 (0)