|
4 | 4 | from typing import Generator |
5 | 5 | import pytest |
6 | 6 |
|
7 | | -from instana.singletons import agent, get_tracer |
8 | | -from instana.tracer import InstanaTracer |
| 7 | +from instana.singletons import agent, tracer |
9 | 8 | from instana.util.traceutils import ( |
10 | 9 | extract_custom_headers, |
11 | | - get_active_tracer, |
12 | 10 | get_tracer_tuple, |
13 | | - tracing_is_off, |
14 | 11 | ) |
15 | 12 |
|
16 | 13 |
|
@@ -66,41 +63,16 @@ def test_extract_custom_headers(self, span, custom_headers, format) -> None: |
66 | 63 | assert span.attributes["http.header.X-Capture-This-Too"] == "this too" |
67 | 64 | assert span.attributes["http.header.X-Capture-That-Too"] == "that too" |
68 | 65 |
|
69 | | - def test_get_activate_tracer(self, mocker) -> None: |
70 | | - assert not get_active_tracer() |
71 | 66 |
|
72 | | - with self.tracer.start_as_current_span("test"): |
73 | | - response = get_active_tracer() |
74 | | - assert isinstance(response, InstanaTracer) |
75 | | - assert response == self.tracer |
76 | | - with mocker.patch( |
77 | | - "instana.span.span.InstanaSpan.is_recording", return_value=False |
78 | | - ): |
79 | | - assert not get_active_tracer() |
| 67 | +def test_get_tracer_tuple() -> None: |
| 68 | + response = get_tracer_tuple() |
| 69 | + assert response == (None, None, None) |
80 | 70 |
|
81 | | - def test_get_tracer_tuple( |
82 | | - self, |
83 | | - ) -> None: |
84 | | - response = get_tracer_tuple() |
85 | | - assert response == (None, None, None) |
| 71 | + agent.options.allow_exit_as_root = True |
| 72 | + response = get_tracer_tuple() |
| 73 | + assert response == (tracer, None, None) |
| 74 | + agent.options.allow_exit_as_root = False |
86 | 75 |
|
87 | | - agent.options.allow_exit_as_root = True |
| 76 | + with tracer.start_as_current_span("test") as span: |
88 | 77 | response = get_tracer_tuple() |
89 | | - assert response == (self.tracer, None, None) |
90 | | - agent.options.allow_exit_as_root = False |
91 | | - |
92 | | - with self.tracer.start_as_current_span("test") as span: |
93 | | - response = get_tracer_tuple() |
94 | | - assert response == (self.tracer, span, span.name) |
95 | | - |
96 | | - def test_tracing_is_off(self) -> None: |
97 | | - response = tracing_is_off() |
98 | | - assert response |
99 | | - with self.tracer.start_as_current_span("test"): |
100 | | - response = tracing_is_off() |
101 | | - assert not response |
102 | | - |
103 | | - agent.options.allow_exit_as_root = True |
104 | | - response = tracing_is_off() |
105 | | - assert not response |
106 | | - agent.options.allow_exit_as_root = False |
| 78 | + assert response == (tracer, span, span.name) |
0 commit comments