Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added testcase for issue #6437 #6684

Merged
merged 2 commits into from Mar 22, 2021
Merged

Added testcase for issue #6437 #6684

merged 2 commits into from Mar 22, 2021

Conversation

thedrow
Copy link
Member

@thedrow thedrow commented Mar 17, 2021

Note: Before submitting this pull request, please review our contributing
guidelines
.

Description

This reproducible minimal test case demonstrates the issue in #6437.
Per project policy, we prefer to have these test cases in our integration test suite so that we'll know if they were accidentally fixed (so that @auvipy won't have to ask).

@maybe-sybr @emanuelmd if you can minimize this further, please go ahead :)

@thedrow thedrow requested review from maybe-sybr and a team March 17, 2021 11:54
@thedrow thedrow self-assigned this Mar 17, 2021
@thedrow thedrow added this to In progress in Celery 5.1.0 via automation Mar 17, 2021
@thedrow thedrow added this to the 5.1.0 milestone Mar 17, 2021
@codecov
Copy link

codecov bot commented Mar 17, 2021

Codecov Report

Merging #6684 (8095953) into master (fc55f2a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6684   +/-   ##
=======================================
  Coverage   70.46%   70.46%           
=======================================
  Files         138      138           
  Lines       16497    16497           
  Branches     2074     2074           
=======================================
  Hits        11625    11625           
  Misses       4669     4669           
  Partials      203      203           
Flag Coverage Δ
unittests 70.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc55f2a...8095953. Read the comment docs.

@emanuelmd
Copy link

emanuelmd commented Mar 17, 2021

Hey @thedrow my issue was slightly different. The failing task was inside the group, I'd tweak the task signature to the following

sig = add.s(1, 1) | add.s(1) | group(add.s(1), fail.s())

@thedrow
Copy link
Member Author

thedrow commented Mar 17, 2021

Both test cases fail. I can add yours to mine 🙂.

@emanuelmd
Copy link

Hmm, your test case doesn't fail in my example. But sure, feel free to add my test case as well.

@thedrow
Copy link
Member Author

thedrow commented Mar 17, 2021

Hey @thedrow my issue was slightly different. The failing task was inside the group, I'd tweak the task signature to the following

sig = add.s(1, 1) | add.s(1) | group(add.s(1), fail.s())

Actually, this passes in our integration test suite.

tox -e 3.9-integration-redis -- -k test_error_propagates_from_chord
3.9-integration-redis develop-inst-noop: /home/thedrow/Documents/Projects/celery
3.9-integration-redis installed: alabaster==0.7.12,amqp==5.0.5,appdirs==1.4.4,attrs==20.3.0,aws-xray-sdk==0.95,azure-core==1.12.0,azure-storage-blob==12.6.0,Babel==2.9.0,billiard==3.6.3.0,boto==2.49.0,boto3==1.17.29,botocore==1.20.29,bump2version==1.0.1,bumpversion==0.6.0,case==1.5.3,cassandra-driver==3.20.2,-e git+git@github.com:celery/celery.git@50bc6f60612e4fe6513ac710fbb948942bca677f#egg=celery,certifi==2020.12.5,cffi==1.14.5,cfgv==3.2.0,chardet==4.0.0,click==7.1.2,click-didyoumean==0.0.3,click-plugins==1.1.1,click-repl==0.1.6,codecov==2.1.11,coverage==5.5,cryptography==3.4.6,DateTime==4.3,distlib==0.3.1,dnspython==1.16.0,docker==4.4.4,docutils==0.16,ecdsa==0.16.1,elasticsearch==7.11.0,ephem==3.7.7.1,eventlet==0.30.2,filelock==3.0.12,flake8==3.9.0,flake8-docstrings==1.5.0,flakeplus==1.1.0,future==0.18.2,gevent==21.1.2,greenlet==1.0.0,identify==2.1.3,idna==2.10,imagesize==1.2.0,iniconfig==1.1.1,isodate==0.6.0,Jinja2==2.11.3,jmespath==0.10.0,jsondiff==1.1.1,jsonpickle==2.0.0,kombu==5.0.2,linecache2==1.0.0,MarkupSafe==1.1.1,mccabe==0.6.1,mock==4.0.3,moto==1.3.7,msgpack==1.0.2,msrest==0.6.21,nodeenv==1.5.0,nose==1.3.7,oauthlib==3.1.0,packaging==20.9,pbr==5.5.1,pluggy==0.13.1,pre-commit==2.11.1,prompt-toolkit==3.0.17,py==1.10.0,pyaml==20.4.0,pyArango==1.3.4,pycodestyle==2.7.0,pycouchdb==1.14.1,pycparser==2.20,pycryptodome==3.10.1,pycurl==7.43.0.5,pydocstyle==5.1.1,pydocumentdb==2.3.2,pyflakes==2.3.0,Pygments==2.8.1,pylibmc==1.6.1,pymongo==3.11.3,pyparsing==2.4.7,pytest==6.2.2,pytest-celery==0.0.0a1,pytest-cov==2.11.1,pytest-rerunfailures==9.1.1,pytest-subtests==0.4.0,pytest-timeout==1.4.2,pytest-travis-fold==1.3.0,python-consul2==0.1.5,python-dateutil==2.8.1,python-jose==2.0.2,python-memcached==1.59,pytz==2021.1,PyYAML==5.4.1,redis==3.5.3,requests==2.25.1,requests-oauthlib==1.3.0,responses==0.13.0,s3transfer==0.3.4,simplejson==3.17.2,six==1.15.0,snowballstemmer==2.1.0,softlayer-messaging==1.0.3,Sphinx==3.5.2,sphinx-celery==2.0.0,sphinx-click==2.5.0,sphinx-testing==0.7.2,sphinx2rst==1.1.0,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==1.0.3,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.4,SQLAlchemy==1.4.0,tblib==1.7.0,toml==0.10.2,tox==3.23.0,traceback2==1.4.0,Unipath==1.1,unittest2==1.1.0,urllib3==1.26.4,vine==5.0.0,virtualenv==20.4.3,wcwidth==0.2.5,websocket-client==0.58.0,Werkzeug==1.0.1,wrapt==1.12.1,xmltodict==0.12.0,zope.event==4.5.0,zope.interface==5.2.0
3.9-integration-redis run-test-pre: PYTHONHASHSEED='2825530395'
3.9-integration-redis run-test: commands[0] | pytest -xsv t/integration -k test_error_propagates_from_chord
================================================================================== test session starts ===================================================================================
platform linux -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /home/thedrow/Documents/Projects/celery/.tox/3.9-integration-redis/bin/python
cachedir: .tox/3.9-integration-redis/.pytest_cache
rootdir: /home/thedrow/Documents/Projects/celery, configfile: setup.cfg
plugins: celery-0.0.0a1, timeout-1.4.2, case-1.5.3, cov-2.11.1, subtests-0.4.0, travis-fold-1.3.0, rerunfailures-9.1.1
collected 113 items / 111 deselected / 2 selected                                                                                                                                        

t/integration/test_canvas.py::test_chord::test_error_propagates_from_chord XFAIL (Issue #6437)
t/integration/test_canvas.py::test_chord::test_error_propagates_from_chord2 PASSED

================================================================ 1 passed, 111 deselected, 1 xfailed in 64.32s (0:01:04) =================================================================
________________________________________________________________________________________ summary _________________________________________________________________________________________
  3.9-integration-redis: commands succeeded
  congratulations :)

This is the test:

    def test_error_propagates_from_chord2(self, manager):
        try:
            manager.app.backend.ensure_chords_allowed()
        except NotImplementedError as e:
            raise pytest.skip(e.args[0])

        sig = add.s(1, 1) | add.s(1) | group(add.s(1), fail.s())
        res = sig.delay()

        with pytest.raises(ExpectedException):
            res.get(timeout=TIMEOUT)

maybe-sybr
maybe-sybr previously approved these changes Mar 17, 2021
Copy link
Contributor

@maybe-sybr maybe-sybr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWICT the test case here is equivalent to the setup in your freezelery repo which I minimised a bit in #6437. I was basically mimicking the behaviour of the raise in fetch_details_for_user()

https://github.com/emanuelmd/freezelery/blob/3d16be91e49739d7ee57d20d9e6bed363721bf16/freezelery.py#L35-L36

which is in the middle of the chain rather than in the group:

https://github.com/emanuelmd/freezelery/blob/3d16be91e49739d7ee57d20d9e6bed363721bf16/freezelery.py#L57-L59

IIRC a task failing at the end the body of a chord is a fairly straightforward failure more and may have always worked back to when I started looking at the canvas code. In any case, it doesn't look like we have a simple test case for task failure in the body of a chord so it can't hurt to add something like test_error_propagates_from_chord2() for the sake of completeness in the test suite.

Interestingly, on a quick read through, test_chord_on_error() appears to actually be a more complicated version of this new test where the final task in what I believe will become the chord headeris the thing that fails. But that test presumably passes, it's not marked xfail... Not sure what to make of that.

This change LGTM, approving as it stands and happy with any change which lands a test like test_error_propagates_from_chord2() as well.

except NotImplementedError as e:
raise pytest.skip(e.args[0])

sig = add.s(1, 1) | fail.s() | group(add.s(1), add.s(1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to construct the chord signature manually for test cases rather than relying on the chain->group promotion behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But perhaps that's what makes the bug since test_chord_on_error() passes :o worth making the change if you have the time to see if we can narrow down what's breaking

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it times out when the failing task is in the middle of the chain. I'm sorry for the confusion @thedrow

Celery 5.1.0 automation moved this from In progress to Reviewer approved Mar 17, 2021
except NotImplementedError as e:
raise pytest.skip(e.args[0])

sig = add.s(1, 1) | fail.s() | group(add.s(1), add.s(1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also add si [immutable signature] in the test suit as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters in this case.

@thedrow
Copy link
Member Author

thedrow commented Mar 18, 2021

Before we merge this, let's add all the examples we can think of.
@maybe-sybr would you mind pushing yours?

Celery 5.1.0 automation moved this from Reviewer approved to Review in progress Mar 21, 2021
@lgtm-com
Copy link

lgtm-com bot commented Mar 21, 2021

This pull request fixes 1 alert when merging 8095953 into fc55f2a - view on LGTM.com

fixed alerts:

  • 1 for Non-exception in 'except' clause

@maybe-sybr
Copy link
Contributor

Before we merge this, let's add all the examples we can think of.
@maybe-sybr would you mind pushing yours?

Since the first case you added here times out, I believe my MRTC from #6437 is already covered. I don't have anything else to add since the second case you added yesterday covers the passing behaviour of the tail fail discussed above as well.

lgtm 👍

Celery 5.1.0 automation moved this from Review in progress to Reviewer approved Mar 21, 2021
@auvipy auvipy merged commit aaef28c into master Mar 22, 2021
Celery 5.1.0 automation moved this from Reviewer approved to Done Mar 22, 2021
@thedrow thedrow deleted the testcase-6437 branch March 22, 2021 06:36
jeyrce pushed a commit to jeyrce/celery that referenced this pull request Aug 25, 2021
* Added testcase for issue celery#6437.

* Add second test case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Celery 5.1.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants