Skip to content

Commit c4639ee

Browse files
authored
Fix flaky celery docker test (open-telemetry#652)
The test was actually generating 2 spans but on very fast systems we only saw one as the test ran faster than the message would travel through the broker, trigger a task and generate 2nd span. Switched from .delay() to .apply() so only one span is generated which is enough for the test in question.
1 parent 2e77bfc commit c4639ee

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/opentelemetry-docker-tests/tests/celery/test_celery_functional.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import celery
1717
from celery.exceptions import Retry
18-
from flaky import flaky
1918
from pytest import mark
2019

2120
import opentelemetry.instrumentation.celery
@@ -559,8 +558,6 @@ class CelerySubClass(CelerySuperClass):
559558
) == async_run_span.attributes.get(SpanAttributes.MESSAGING_MESSAGE_ID)
560559

561560

562-
# FIXME find a permanent solution for the flakiness of this test
563-
@flaky
564561
def test_custom_tracer_provider(celery_app, memory_exporter):
565562
@celery_app.task
566563
def fn_task():
@@ -576,7 +573,7 @@ def fn_task():
576573
CeleryInstrumentor().uninstrument()
577574
CeleryInstrumentor().instrument(tracer_provider=tracer_provider)
578575

579-
fn_task.delay()
576+
fn_task.apply()
580577

581578
spans_list = memory_exporter.get_finished_spans()
582579
assert len(spans_list) == 1

0 commit comments

Comments
 (0)