From 21eddfb80f17d3f0ee8dbc75582e4651c3088d0a Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Wed, 5 Feb 2025 18:12:36 -0500 Subject: [PATCH 1/2] ci(tracer): do not shutdown the global tracer --- tests/tracer/test_propagation.py | 2 -- tests/tracer/test_tracer.py | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/tracer/test_propagation.py b/tests/tracer/test_propagation.py index f79116826d3..e34167ce04f 100644 --- a/tests/tracer/test_propagation.py +++ b/tests/tracer/test_propagation.py @@ -47,7 +47,6 @@ from tests.contrib.fastapi.conftest import test_spans as fastapi_test_spans # noqa:F401 from tests.contrib.fastapi.conftest import tracer # noqa:F401 -from ..utils import flaky from ..utils import override_env from ..utils import override_global_config @@ -837,7 +836,6 @@ def test_extract_128bit_trace_ids_tracecontext(): assert child_span.trace_id == trace_id -@flaky(1735812000, reason="FIXME: Failing due to the global tracer being used in all tests") def test_last_dd_span_id(): non_dd_remote_context = HTTPPropagator.extract( { diff --git a/tests/tracer/test_tracer.py b/tests/tracer/test_tracer.py index 85d8be52a36..e5d42bbe648 100644 --- a/tests/tracer/test_tracer.py +++ b/tests/tracer/test_tracer.py @@ -676,6 +676,7 @@ def test_tracer_shutdown_timeout(): mock_stop.assert_called_once_with(2) +@pytest.mark.subprocess def test_tracer_shutdown(): import mock @@ -690,7 +691,7 @@ def test_tracer_shutdown(): mock_write.assert_not_called() - +@pytest.mark.subprocess def test_tracer_shutdown_warning(): import logging From c5f0eba9f990e5f7cf01a271cceac7649698d5e0 Mon Sep 17 00:00:00 2001 From: Munir Abdinur Date: Wed, 5 Feb 2025 21:47:14 -0500 Subject: [PATCH 2/2] fmt --- tests/tracer/test_tracer.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/tests/tracer/test_tracer.py b/tests/tracer/test_tracer.py index e5d42bbe648..3445dfbefb2 100644 --- a/tests/tracer/test_tracer.py +++ b/tests/tracer/test_tracer.py @@ -676,7 +676,9 @@ def test_tracer_shutdown_timeout(): mock_stop.assert_called_once_with(2) -@pytest.mark.subprocess +@pytest.mark.subprocess( + err=b"Spans started after the tracer has been shut down will not be sent to the Datadog Agent.\n", +) def test_tracer_shutdown(): import mock @@ -691,26 +693,6 @@ def test_tracer_shutdown(): mock_write.assert_not_called() -@pytest.mark.subprocess -def test_tracer_shutdown_warning(): - import logging - - import mock - - from ddtrace.trace import tracer as t - - t.shutdown() - - with mock.patch.object(logging.Logger, "warning") as mock_logger: - with t.trace("something"): - pass - - mock_logger.assert_has_calls( - [ - mock.call("Spans started after the tracer has been shut down will not be sent to the Datadog Agent."), - ] - ) - @pytest.mark.skip(reason="Fails to Pickle RateLimiter in the Tracer") @pytest.mark.subprocess