From ef302db7f7c78c13f823ca0d20d3ca1bc2ba6311 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 11 Jan 2025 14:30:32 +1300 Subject: [PATCH] Add basic test for `trace_context=`. --- test/traces/backend/open_telemetry.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/traces/backend/open_telemetry.rb b/test/traces/backend/open_telemetry.rb index 0e5bc66..e1dcb1f 100644 --- a/test/traces/backend/open_telemetry.rb +++ b/test/traces/backend/open_telemetry.rb @@ -95,5 +95,22 @@ def my_span_and_context ) end end + + with '#trace_context=' do + it "can update trace context" do + Traces.trace_context = context + + span = instance.my_span + + expect(span.context).to have_attributes( + trace_id: be == context.trace_id, + ) + + # It seems like OpenTelemetry doesn't really do anything in the testing environment, so we can't really check the parent_id? + # expect(span).to have_attributes( + # parent_id: be == context.parent_id + # ) + end + end end end