Skip to content

Commit

Permalink
Fix the test_simple_chord_with_a_delay_in_group_save test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Katz committed Dec 5, 2019
1 parent 3d82796 commit f359138
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions t/integration/test_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from celery.backends.base import BaseKeyValueStoreBackend
from celery.exceptions import TimeoutError
from celery.result import AsyncResult, GroupResult, ResultSet

from .conftest import get_active_redis_channels, get_redis_connection
from .tasks import (ExpectedException, add, add_chord_to_chord, add_replaced,
add_to_all, add_to_all_to_chord, build_chain_inside_task,
Expand Down Expand Up @@ -528,22 +527,22 @@ def test_simple_chord_with_a_delay_in_group_save(self, manager, monkeypatch):
raise pytest.skip(e.args[0])

if not isinstance(manager.app.backend, BaseKeyValueStoreBackend):
raise pytest.skip("The delay may only occur in key/value backends")
raise pytest.skip("The delay may only occur in the cache backend")

x = manager.app.backend._apply_chord_incr
x = BaseKeyValueStoreBackend._apply_chord_incr

def apply_chord_incr_with_sleep(*args, **kwargs):
def apply_chord_incr_with_sleep(self, *args, **kwargs):
sleep(1)
x(*args, **kwargs)
x(self, *args, **kwargs)

monkeypatch.setattr(BaseKeyValueStoreBackend,
'_apply_chord_incr',
apply_chord_incr_with_sleep)

c = group(add.si(1, 1), add.si(1, 1)) | tsum.s()
c = chord(header=[add.si(1, 1), add.si(1, 1)], body=tsum.s())

result = c()
assert result.get() == 4
assert result.get(timeout=TIMEOUT) == 4

@pytest.mark.flaky(reruns=5, reruns_delay=1, cause=is_retryable_exception)
def test_redis_subscribed_channels_leak(self, manager):
Expand Down

0 comments on commit f359138

Please sign in to comment.