Skip to content

Introduce e2e testing with testcontainers#54072

Merged
gopidesupavan merged 14 commits intoapache:mainfrom
gopidesupavan:e2e-testing
Sep 11, 2025
Merged

Introduce e2e testing with testcontainers#54072
gopidesupavan merged 14 commits intoapache:mainfrom
gopidesupavan:e2e-testing

Conversation

@gopidesupavan
Copy link
Copy Markdown
Member

@gopidesupavan gopidesupavan commented Aug 3, 2025

Introducing End to End testing to test against real environment with dags.

We can write all the possible scenario dags and test on real environment.
For now i have added a simple dag that triggers dag and validates xcom value.
Extend this to more complex scenario to validate.

My plan is it have a schedule run frequently similar to canary to validate all the tests thats under e2e.
edit: Default it runs in canary after prod image built.

We can utilise this one to test on RC releases likely provide input to image version and run all the tests. So once release manager cuts RC and released then he can trigger this test suite. IMHO very useful to test.

  • Add breeze support
  • Add documentation

^ 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 airflow-core/newsfragments.

@gopidesupavan
Copy link
Copy Markdown
Member Author

Should we have e2e testing separate repo and keep all the tests there and uses them part of workflow? 🤔

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Aug 3, 2025

Should we have e2e testing separate repo and keep all the tests there and uses them part of workflow? 🤔

I think separate repo is generally a bad idea. Monorepo has it's drawbacks - but it has also benefits - for example much easier syncing of dependencie with workspace, keeping single contribuition workflow, being able to stop PR from merging when the tests fail etc. I can't see any real benefit of having separate repo for tests that should essentially be run as part of the same workflow as all other tests (especially when we have uv sync and workspaces.

@gopidesupavan
Copy link
Copy Markdown
Member Author

Should we have e2e testing separate repo and keep all the tests there and uses them part of workflow? 🤔

I think separate repo is generally a bad idea. Monorepo has it's drawbacks - but it has also benefits - for example much easier syncing of dependencie with workspace, keeping single contribuition workflow, being able to stop PR from merging when the tests fail etc. I can't see any real benefit of having separate repo for tests that should essentially be run as part of the same workflow as all other tests (especially when we have uv sync and workspaces.

agree make sense :) do you think we should run these e2e tests part PR's, i am thinking of we can do it in schedule, i remember @kaxil was mentioning there were around 200+ test scenario combinations for xcoms itself so i think it would fit in schedule run? WDYT?

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Aug 3, 2025

for xcoms itself so i think it would fit in schedule run? WDYT?

a) we can improve selective tests to trigger a relevant subset of those
b) we can run full set in canary runs

@gopidesupavan
Copy link
Copy Markdown
Member Author

gopidesupavan commented Aug 3, 2025

for xcoms itself so i think it would fit in schedule run? WDYT?

a) we can improve selective tests to trigger a relevant subset of those b) we can run full set in canary runs

yes that also works good idea ;)

@gopidesupavan
Copy link
Copy Markdown
Member Author

getting this one ready today, we should be able to catch more errors running actual dag scenarios, like the recent secrets issue.

@gopidesupavan
Copy link
Copy Markdown
Member Author

@vatsrahul1001 am adding e2e test suite to CI and this can be triggered part of regular CI or after rc release it helps detecting any issues by running e2e tests.

Could you please help me what test suite you regularly run and the all the example dags you have setup for testing? i will add it to test suite.

@kaxil please add your thoughts on this if you have anything in mind to cover specifically combination of scenarios. i see you mentioned here around 254 combinations it would be good to know those :) #53130 (comment)

@kaxil
Copy link
Copy Markdown
Member

kaxil commented Aug 21, 2025

@vatsrahul1001 am adding e2e test suite to CI and this can be triggered part of regular CI or after rc release it helps detecting any issues by running e2e tests.

Could you please help me what test suite you regularly run and the all the example dags you have setup for testing? i will add it to test suite.

@kaxil please add your thoughts on this if you have anything in mind to cover specifically combination of scenarios. i see you mentioned here around 254 combinations it would be good to know those :) #53130 (comment)

Hey @gopidesupavan 👋

It is

@pytest.mark.parametrize(
"map_indexes",
[
pytest.param(-1, id="not_mapped_index"),
pytest.param(1, id="single_map_index"),
pytest.param([0, 1], id="multiple_map_indexes"),
pytest.param((0, 1), id="any_iterable_multi_indexes"),
pytest.param(None, id="index_none"),
pytest.param(NOTSET, id="index_not_set"),
],
)
@pytest.mark.parametrize(
"task_ids",
[
pytest.param("push_task", id="single_task"),
pytest.param(["push_task1", "push_task2"], id="tid_multiple_tasks"),
pytest.param({"push_task1", "push_task2"}, id="tid_any_iterable"),
pytest.param(None, id="tid_none"),
pytest.param(NOTSET, id="tid_not_set"),
],
)
@pytest.mark.parametrize(
"xcom_values",
[
pytest.param("hello", id="string_value"),
pytest.param("'hello'", id="quoted_string_value"),
pytest.param({"key": "value"}, id="json_value"),
pytest.param([], id="empty_list_no_xcoms_found"),
pytest.param((1, 2, 3), id="tuple_int_value"),
pytest.param([1, 2, 3], id="list_int_value"),
pytest.param(42, id="int_value"),
pytest.param(True, id="boolean_value"),
pytest.param(pd.DataFrame({"col1": [1, 2], "col2": [3, 4]}), id="dataframe_value"),
],
)
def test_xcom_pull(

root@6cb799c71804:/opt/airflow# pytest task-sdk/tests/task_sdk/execution_time/test_task_runner.py::TestRuntimeTaskInstance::test_xcom_pull --collect-only

...
...
==== 270 tests collected in 2.69s ======

@gopidesupavan
Copy link
Copy Markdown
Member Author

@vatsrahul1001 am adding e2e test suite to CI and this can be triggered part of regular CI or after rc release it helps detecting any issues by running e2e tests.
Could you please help me what test suite you regularly run and the all the example dags you have setup for testing? i will add it to test suite.
@kaxil please add your thoughts on this if you have anything in mind to cover specifically combination of scenarios. i see you mentioned here around 254 combinations it would be good to know those :) #53130 (comment)

Hey @gopidesupavan 👋

It is

@pytest.mark.parametrize(
"map_indexes",
[
pytest.param(-1, id="not_mapped_index"),
pytest.param(1, id="single_map_index"),
pytest.param([0, 1], id="multiple_map_indexes"),
pytest.param((0, 1), id="any_iterable_multi_indexes"),
pytest.param(None, id="index_none"),
pytest.param(NOTSET, id="index_not_set"),
],
)
@pytest.mark.parametrize(
"task_ids",
[
pytest.param("push_task", id="single_task"),
pytest.param(["push_task1", "push_task2"], id="tid_multiple_tasks"),
pytest.param({"push_task1", "push_task2"}, id="tid_any_iterable"),
pytest.param(None, id="tid_none"),
pytest.param(NOTSET, id="tid_not_set"),
],
)
@pytest.mark.parametrize(
"xcom_values",
[
pytest.param("hello", id="string_value"),
pytest.param("'hello'", id="quoted_string_value"),
pytest.param({"key": "value"}, id="json_value"),
pytest.param([], id="empty_list_no_xcoms_found"),
pytest.param((1, 2, 3), id="tuple_int_value"),
pytest.param([1, 2, 3], id="list_int_value"),
pytest.param(42, id="int_value"),
pytest.param(True, id="boolean_value"),
pytest.param(pd.DataFrame({"col1": [1, 2], "col2": [3, 4]}), id="dataframe_value"),
],
)
def test_xcom_pull(

root@6cb799c71804:/opt/airflow# pytest task-sdk/tests/task_sdk/execution_time/test_task_runner.py::TestRuntimeTaskInstance::test_xcom_pull --collect-only

...
...
==== 270 tests collected in 2.69s ======

cool thanks will make these combinations to execute on real dag scenario.

@vatsrahul1001
Copy link
Copy Markdown
Contributor

@vatsrahul1001 am adding e2e test suite to CI and this can be triggered part of regular CI or after rc release it helps detecting any issues by running e2e tests.

Could you please help me what test suite you regularly run and the all the example dags you have setup for testing? i will add it to test suite.

@kaxil please add your thoughts on this if you have anything in mind to cover specifically combination of scenarios. i see you mentioned here around 254 combinations it would be good to know those :) #53130 (comment)

This is great work and will be very helpful during the RC testing phase! A good starting point could be running all the example DAGs that already exist, as they cover a wide range of features. From there, our team can also look into contributing additional DAGs that reflect some others common use cases.

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Aug 22, 2025

This is great work and will be very helpful during the RC testing phase! A good starting point could be running all the example DAGs that already exist, as they cover a wide range of features. From there, our team can also look into contributing additional DAGs that reflect some others common use cases.

Agreed :)

@gopidesupavan
Copy link
Copy Markdown
Member Author

This is great work and will be very helpful during the RC testing phase! A good starting point could be running all the example DAGs that already exist, as they cover a wide range of features. From there, our team can also look into contributing additional DAGs that reflect some others common use cases.

Agreed :)

Yeah have already plan to include them part of this. working on them currently.

@gopidesupavan gopidesupavan force-pushed the e2e-testing branch 3 times, most recently from 28abb8b to b4c2b31 Compare August 23, 2025 09:53
@gopidesupavan
Copy link
Copy Markdown
Member Author

gopidesupavan commented Aug 23, 2025

Oh github actions is not allowing some patterns in file paths.

With the provided path, there will be 352 files uploaded
Artifact name is valid!
Root directory input is valid!
Error: The path for one of the files in artifact is not valid: /dag_id=example_bash_decorator/run_id=manual__2025-08-23T10:27:47.958128+00:00/task_id=also_run_this/attempt=1.log. Contains the following character:  Colon :
          
Invalid characters include:  Double quote ", Colon :, Less than <, Greater than >, Vertical bar |, Asterisk *, Question mark ?, Carriage return \r, Line feed \n
          
The following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.

@gopidesupavan gopidesupavan marked this pull request as ready for review August 25, 2025 21:16
@gopidesupavan
Copy link
Copy Markdown
Member Author

Finally ready for review.

@gopidesupavan
Copy link
Copy Markdown
Member Author

Would like to get this first pass simple and added basic test and test to trigger example dags. will extend this for further xcoms/connections etc;

@vatsrahul1001 can also extend on top of this, feel free to add your suite in this :)

@gopidesupavan gopidesupavan requested a review from kaxil August 25, 2025 21:19
Comment thread airflow-e2e-tests/tests/airflow_e2e_tests/e2e_test_utils/clients.py
Copy link
Copy Markdown
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Fantastic job @gopidesupavan . Just some nit comments.

@potiuk
Copy link
Copy Markdown
Member

potiuk commented Sep 3, 2025

Not sure if we intend to backport it, but It might be possible actually, so I left the label,.

@gopidesupavan
Copy link
Copy Markdown
Member Author

Not sure if we intend to backport it, but It might be possible actually, so I left the label,.

🤔 yeah not sure, these test runs in canary anyway it hints if anything breaks.

@gopidesupavan
Copy link
Copy Markdown
Member Author

Finally green :) merging it now.

@gopidesupavan gopidesupavan merged commit 0954496 into apache:main Sep 11, 2025
196 checks passed
@gopidesupavan gopidesupavan deleted the e2e-testing branch September 11, 2025 19:37
@github-actions
Copy link
Copy Markdown
Contributor

Backport failed to create: v3-0-test. View the failure log Run details

Status Branch Result
v3-0-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 0954496 v3-0-test

This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

suman-himanshu pushed a commit to suman-himanshu/airflow that referenced this pull request Sep 17, 2025
* Introduce e2e testing with testcontainers

* Fix test command

* Fix test command

* Upload test report

* Add option to trigger with workflow_dispatch

* Add test to trigger example dags

* Upload logs

* Upload logs

* zip logs

* Fix example_bash_decorator file stat function

* Add breeze commands and docs

* Update breeze commands

* Make docker-image-tag to empty and determine in conftest for canary build

* Fix mnt writable
Brunda10 pushed a commit to Brunda10/airflow that referenced this pull request Sep 17, 2025
* Introduce e2e testing with testcontainers

* Fix test command

* Fix test command

* Upload test report

* Add option to trigger with workflow_dispatch

* Add test to trigger example dags

* Upload logs

* Upload logs

* zip logs

* Fix example_bash_decorator file stat function

* Add breeze commands and docs

* Update breeze commands

* Make docker-image-tag to empty and determine in conftest for canary build

* Fix mnt writable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants