From c6976fc51f192387c7cedee6f3a270930eb07b48 Mon Sep 17 00:00:00 2001 From: Owais Lone Date: Thu, 26 Aug 2021 03:30:26 +0530 Subject: [PATCH] Potential fix for flaky celery test (#629) It seems the same in memory span exporter was being reused by multiple tests. This change _should_ create a new instance of memeory exporter per test/function. Fixes #2067 --- tests/opentelemetry-docker-tests/tests/celery/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/opentelemetry-docker-tests/tests/celery/conftest.py b/tests/opentelemetry-docker-tests/tests/celery/conftest.py index e2bd00aa01..8dc36ca7bd 100644 --- a/tests/opentelemetry-docker-tests/tests/celery/conftest.py +++ b/tests/opentelemetry-docker-tests/tests/celery/conftest.py @@ -70,7 +70,7 @@ def instrument(tracer_provider, memory_exporter): CeleryInstrumentor().uninstrument() -@pytest.fixture(scope="session") +@pytest.fixture(scope="function") def tracer_provider(memory_exporter): original_tracer_provider = trace_api.get_tracer_provider() @@ -86,7 +86,7 @@ def tracer_provider(memory_exporter): trace_api.set_tracer_provider(original_tracer_provider) -@pytest.fixture(scope="session") +@pytest.fixture(scope="function") def memory_exporter(): memory_exporter = InMemorySpanExporter() return memory_exporter