Skip to content

Split Celery integration tests to "celery" and "redis" - #39994

Merged
eladkal merged 1 commit into
apache:mainfrom
shahar1:split-celery-integration-tests
Jun 10, 2024
Merged

eladkal merged 1 commit into
apache:mainfrom
shahar1:split-celery-integration-tests

Conversation

@shahar1

@shahar1 shahar1 commented Jun 1, 2024 •

Copy link
Copy Markdown
Contributor

closes: #34032

This PR takes care of the following:

  • Splitting integration tests specific to the redis provider into their own category, as it makes testing more precise and avoids unnecessary initialization of the rabbitmq service.
  • Running all celery tests with all possible brokers (currently only redis and rabbitmq). If a broker exists as an independent provider that has its own integration tests, we could import the service from the integration-<PROVIDER>.yml into the integration-celery.yml using docker-compose extension mechanism.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@shahar1
shahar1 force-pushed the split-celery-integration-tests branch from 620214d to 171046d Compare June 1, 2024 13:46
@shahar1
shahar1 marked this pull request as draft June 1, 2024 13:52
@shahar1
shahar1 force-pushed the split-celery-integration-tests branch from 171046d to d98d919 Compare June 1, 2024 14:00
@shahar1
shahar1 marked this pull request as ready for review June 1, 2024 14:00
@potiuk

potiuk commented Jun 1, 2024

Copy link
Copy Markdown
Member

Hmmm. I am not sure (to be honest) how this would work ... But I think I have little clarity myself what I wanted to do there..

Question: could you explain in your words what this task is about :D ? Maybe we can get to common understanding :D

@shahar1

shahar1 commented Jun 1, 2024

Copy link
Copy Markdown
Contributor Author

Hmmm. I am not sure (to be honest) how this would work ... But I think I have little clarity myself what I wanted to do there..

Question: could you explain in your words what this task is about :D ? Maybe we can get to common understanding :D

I'll try to split it into two parts from my understanding:

  1. In the first part of the original issue, the integration tests for Celery only utilize Redis as a broker and result backend. This PR addresses this issue by parameterizing the broker URL and running the same integration test for both Redis and Rabbitmq (it could be helpful for future alternatives if we decide to support them).

  2. In the second part of the issue, you referred to a faulty caused by a version conflict between Celery and SQLAlchemy, and by creating an appropriate integration test, we could have discovered it in the CI. This PR doesn't address this issue (maybe it's a good time for a disclosure that I haven't touched the more "core" parts of Airflow components yet, so I might need more time to learn this area).

I'd be happy if you could merge this one, and create a separate issue for the second part (if you think that it's still relevant and worth implementing).

@potiuk

potiuk commented Jun 1, 2024

Copy link
Copy Markdown
Member

Ah... Now I know what the problem with my understanding was ... Actually the tests already supported both redis and rabbitmq by the very same parameterisation - so your change just organizes it a bit better by converting it in a map and extracting the constants.

There are two tests only that use the _prepare_test_bodies method and that did not change in your PR.

The idea however was to run all the integration tests for celery in similar way - once with rabbitmq and once with redis. Likely by running two different integrations "celery-rabbitmq" , "celery-redis" - basically running the same tests. This would require to change the marker logic a BIT I think - because that is not currently possible/easy.

@shahar1

shahar1 commented Jun 1, 2024

Copy link
Copy Markdown
Contributor Author

Ah... Now I know what the problem with my understanding was ... Actually the tests already supported both redis and rabbitmq by the very same parameterisation - so your change just organizes it a bit better by converting it in a map and extracting the constants.

There are two tests only that use the _prepare_test_bodies method and that did not change in your PR.

The idea however was to run all the integration tests for celery in similar way - once with rabbitmq and once with redis. Likely by running two different integrations "celery-rabbitmq" , "celery-redis" - basically running the same tests. This would require to change the marker logic a BIT I think - because that is not currently possible/easy.

Gotcha, I'll try to dig deeper into that

@shahar1
shahar1 force-pushed the split-celery-integration-tests branch 4 times, most recently from b86b381 to 40ed016 Compare June 8, 2024 07:17
@shahar1 shahar1 changed the title Split Celery integration tests to "redis" and "rabbitmq" Split Celery integration tests to "celery" and "redis" Jun 8, 2024
@shahar1
shahar1 force-pushed the split-celery-integration-tests branch from 40ed016 to c724e96 Compare June 8, 2024 07:25
@shahar1

shahar1 commented Jun 8, 2024

Copy link
Copy Markdown
Contributor Author

@potiuk So eventually, I thought that it would be easier and more precise to make integration tests for redis provider run separately (without rabbitmq running in the background),
and make the tests for celery to import the redis service above using the extension mechanism so we won't have to duplicate code.
I updated the description in the PR so it would become clearer.

@shahar1
shahar1 force-pushed the split-celery-integration-tests branch from c724e96 to 9954a2b Compare June 8, 2024 07:40
@potiuk

potiuk commented Jun 8, 2024

Copy link
Copy Markdown
Member

Good idea. ❤️ it. Just the descripton should be updated.

@shahar1
shahar1 force-pushed the split-celery-integration-tests branch from 9954a2b to fbb30a6 Compare June 8, 2024 20:49
@shahar1

shahar1 commented Jun 8, 2024

Copy link
Copy Markdown
Contributor Author

Good idea. ❤️ it. Just the descripton should be updated.

Done :)

@eladkal eladkal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!

@shahar1
shahar1 force-pushed the split-celery-integration-tests branch from fbb30a6 to 0be7f44 Compare June 8, 2024 21:08
@eladkal
eladkal merged commit 74a1931 into apache:main Jun 10, 2024
@shahar1
shahar1 deleted the split-celery-integration-tests branch June 11, 2024 10:55
@ephraimbuddy ephraimbuddy added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Jul 1, 2024
@ephraimbuddy ephraimbuddy added this to the Airflow 2.10.0 milestone Jul 1, 2024
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split Celery integration tests in to "redis", "rabbitmq", "sqlalchemy"

5 participants