Skip to content

Commit

Permalink
Fix flaky celery docker test (#652)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
owais authored Sep 2, 2021
1 parent 2e77bfc commit c4639ee
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import celery
from celery.exceptions import Retry
from flaky import flaky
from pytest import mark

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


# FIXME find a permanent solution for the flakiness of this test
@flaky
def test_custom_tracer_provider(celery_app, memory_exporter):
@celery_app.task
def fn_task():
Expand All @@ -576,7 +573,7 @@ def fn_task():
CeleryInstrumentor().uninstrument()
CeleryInstrumentor().instrument(tracer_provider=tracer_provider)

fn_task.delay()
fn_task.apply()

spans_list = memory_exporter.get_finished_spans()
assert len(spans_list) == 1
Expand Down

0 comments on commit c4639ee

Please sign in to comment.