Skip to content

Commit

Permalink
fix(celery): increase async timeout for tests (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
majorgreys committed Jun 26, 2020
1 parent f8e947c commit 3c366b2
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
from opentelemetry.sdk.trace import TracerProvider, export
from opentelemetry.trace.status import StatusCanonicalCode

# set a high timeout for async executions due to issues in CI
ASYNC_GET_TIMEOUT = 120


class MyException(Exception):
pass
Expand All @@ -38,7 +41,7 @@ def fn_task():
return 42

result = fn_task.apply_async()
assert result.get() == 42
assert result.get(timeout=ASYNC_GET_TIMEOUT) == 42

spans = memory_exporter.get_finished_spans()
assert len(spans) == 2
Expand Down Expand Up @@ -144,7 +147,7 @@ def fn_task_parameters(user, force_logout=False):
result = fn_task_parameters.apply_async(
args=["user"], kwargs={"force_logout": True}
)
assert result.get(timeout=10) == ["user", True]
assert result.get(timeout=ASYNC_GET_TIMEOUT) == ["user", True]

spans = memory_exporter.get_finished_spans()
assert len(spans) == 2
Expand Down Expand Up @@ -181,7 +184,7 @@ def fn_task():
results = [fn_task.delay() for _ in range(100)]

for result in results:
assert result.get(timeout=1) == 42
assert result.get(timeout=ASYNC_GET_TIMEOUT) == 42

spans = memory_exporter.get_finished_spans()

Expand All @@ -194,7 +197,7 @@ def fn_task_parameters(user, force_logout=False):
return (user, force_logout)

result = fn_task_parameters.delay("user", force_logout=True)
assert result.get(timeout=10) == ["user", True]
assert result.get(timeout=ASYNC_GET_TIMEOUT) == ["user", True]

spans = memory_exporter.get_finished_spans()
assert len(spans) == 2
Expand Down Expand Up @@ -448,7 +451,7 @@ def run(self, *args, **kwargs):
# avoid call loop
return
CelerySubClass.apply_async(args=[], kwargs={"stop": True}).get(
timeout=10
timeout=ASYNC_GET_TIMEOUT
)

class CelerySubClass(CelerySuperClass):
Expand Down

0 comments on commit 3c366b2

Please sign in to comment.