Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Apr 26, 2025

The docker compose tests on linux have been broken by #49681 because of:

a) perrmission problems with config folder - airflow.cfg created
eventually was owned by root, not airflow user and it was not
readable by the airflow user
b) the airflow.cfg has not been initialized in init because airflow
version command does not create config
c) config directory has not been crated in the docker-compose test d) /opts/ directory was used to create dirs instead of /opt/ when
changing permissions
e) chown -R does not work across the volumes

Also it turned out that diagnostic in case of health-check problms has been broken and did not show the actual errors - because while handling exception of health check api calls were made that also raised exception that was subsequently silently swallowed and did not allow the logs and heealth-check information from the test to be printed.

This PR fixes those problems:

a) creates config folder during tests
b) runs "airflow config list" in init that actually creates a
default config when no manual configuration is specified
c) changes ownership for the internal folders after the config
file is created which allows airflow user to read it, also
spearately changes ownership for /opt/airflow (volume in image)
and all the shared volumes mounted from the host.
d) improves diagnostic by switching to rich print and handing the
health exceptions during exception handling, allowing to print
detailed logs of what happened
e) the output of breeze testing docker-compose-tests is printed
directly to stdout (with pytest -s flag) - so that we see
the progress of test as it happens - both locally and in CI.


^ 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.

The docker compose tests on linux have been broken by apache#49681 because
of:

a) perrmission problems with config folder - airflow.cfg created
   eventually was owned by root, not airflow user and it was not
   readable by the airflow user
b) the airflow.cfg has not been initialized in init because airflow
   version command does not create config
c) config directory has not been crated in the docker-compose test
d) /opts/ directory was used to create dirs instead of /opt/ when
   changing permissions
e) chown -R does not work across the volumes

Also it turned out that diagnostic in case of health-check problms
has been broken and did not show the actual errors - because
while handling exception of health check api calls were made that
also raised exception that was subsequently silently swallowed and
did not allow the logs and heealth-check information from the test
to be printed.

This PR fixes those problems:

a) creates config folder during tests
b) runs "airflow config list" in init that actually creates a
   default config when no manual configuration is specified
c) changes ownership for the internal folders after the config
   file is created which allows airflow user to read it, also
   spearately changes ownership for /opt/airflow (volume in image)
   and all the shared volumes mounted from the host.
d) improves diagnostic by switching to rich print and handing the
   health exceptions during exception handling, allowing to print
   detailed logs of what happened
e) the output of `breeze testing docker-compose-tests` is printed
   directly to stdout (with pytest `-s` flag) - so that we see
   the progress of test as it happens - both locally and in CI.
@potiuk
Copy link
Member Author

potiuk commented Apr 26, 2025

cc: @dheerajturaga -> there were quite a few issues with the docker-compose on Linux after #49814 - I fixed all of them and improved diagnostics (a lot) for the future.

@potiuk potiuk added this to the Airflow 3.0.1 milestone Apr 26, 2025
@potiuk potiuk added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Apr 26, 2025
@potiuk
Copy link
Member Author

potiuk commented Apr 26, 2025

One of the problems solved is that if the docker-compose was unhealthy, all the logs and service information has not been printed on error and we did not see progress of the tests.

With this change - when there is an error - this kind of logs will be printed:

image

You can also test it locally even if everything works with --include-success-outputs flag.

@potiuk potiuk enabled auto-merge (squash) April 26, 2025 10:23
Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

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

Much better! These diagnostics will surely help

@kaxil kaxil disabled auto-merge April 26, 2025 10:46
@kaxil kaxil enabled auto-merge (squash) April 26, 2025 10:46
@kaxil kaxil merged commit 67ce622 into apache:main Apr 26, 2025
100 of 101 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 26, 2025
The docker compose tests on linux have been broken by #49681 because
of:

a) perrmission problems with config folder - airflow.cfg created
   eventually was owned by root, not airflow user and it was not
   readable by the airflow user
b) the airflow.cfg has not been initialized in init because airflow
   version command does not create config
c) config directory has not been crated in the docker-compose test
d) /opts/ directory was used to create dirs instead of /opt/ when
   changing permissions
e) chown -R does not work across the volumes

Also it turned out that diagnostic in case of health-check problms
has been broken and did not show the actual errors - because
while handling exception of health check api calls were made that
also raised exception that was subsequently silently swallowed and
did not allow the logs and heealth-check information from the test
to be printed.

This PR fixes those problems:

a) creates config folder during tests
b) runs "airflow config list" in init that actually creates a
   default config when no manual configuration is specified
c) changes ownership for the internal folders after the config
   file is created which allows airflow user to read it, also
   spearately changes ownership for /opt/airflow (volume in image)
   and all the shared volumes mounted from the host.
d) improves diagnostic by switching to rich print and handing the
   health exceptions during exception handling, allowing to print
   detailed logs of what happened
e) the output of `breeze testing docker-compose-tests` is printed
   directly to stdout (with pytest `-s` flag) - so that we see
   the progress of test as it happens - both locally and in CI.
(cherry picked from commit 67ce622)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
@github-actions
Copy link

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

Cool!

@gopidesupavan
Copy link
Member

Nice and clear :)

potiuk added a commit that referenced this pull request Apr 26, 2025
The docker compose tests on linux have been broken by #49681 because
of:

a) perrmission problems with config folder - airflow.cfg created
   eventually was owned by root, not airflow user and it was not
   readable by the airflow user
b) the airflow.cfg has not been initialized in init because airflow
   version command does not create config
c) config directory has not been crated in the docker-compose test
d) /opts/ directory was used to create dirs instead of /opt/ when
   changing permissions
e) chown -R does not work across the volumes

Also it turned out that diagnostic in case of health-check problms
has been broken and did not show the actual errors - because
while handling exception of health check api calls were made that
also raised exception that was subsequently silently swallowed and
did not allow the logs and heealth-check information from the test
to be printed.

This PR fixes those problems:

a) creates config folder during tests
b) runs "airflow config list" in init that actually creates a
   default config when no manual configuration is specified
c) changes ownership for the internal folders after the config
   file is created which allows airflow user to read it, also
   spearately changes ownership for /opt/airflow (volume in image)
   and all the shared volumes mounted from the host.
d) improves diagnostic by switching to rich print and handing the
   health exceptions during exception handling, allowing to print
   detailed logs of what happened
e) the output of `breeze testing docker-compose-tests` is printed
   directly to stdout (with pytest `-s` flag) - so that we see
   the progress of test as it happens - both locally and in CI.
(cherry picked from commit 67ce622)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
@dheerajturaga
Copy link
Member

Pretty clean! Thank you!!

potiuk added a commit to potiuk/airflow that referenced this pull request Apr 26, 2025
potiuk added a commit that referenced this pull request Apr 26, 2025
github-actions bot pushed a commit that referenced this pull request Apr 26, 2025
Missed in #49814
(cherry picked from commit 2eb5928)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
github-actions bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Apr 26, 2025
Missed in apache#49814
(cherry picked from commit 2eb5928)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
potiuk added a commit that referenced this pull request Apr 26, 2025
Missed in #49814
(cherry picked from commit 2eb5928)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
jroachgolf84 pushed a commit to jroachgolf84/airflow that referenced this pull request Apr 30, 2025
The docker compose tests on linux have been broken by apache#49681 because
of:

a) perrmission problems with config folder - airflow.cfg created
   eventually was owned by root, not airflow user and it was not
   readable by the airflow user
b) the airflow.cfg has not been initialized in init because airflow
   version command does not create config
c) config directory has not been crated in the docker-compose test
d) /opts/ directory was used to create dirs instead of /opt/ when
   changing permissions
e) chown -R does not work across the volumes

Also it turned out that diagnostic in case of health-check problms
has been broken and did not show the actual errors - because
while handling exception of health check api calls were made that
also raised exception that was subsequently silently swallowed and
did not allow the logs and heealth-check information from the test
to be printed.

This PR fixes those problems:

a) creates config folder during tests
b) runs "airflow config list" in init that actually creates a
   default config when no manual configuration is specified
c) changes ownership for the internal folders after the config
   file is created which allows airflow user to read it, also
   spearately changes ownership for /opt/airflow (volume in image)
   and all the shared volumes mounted from the host.
d) improves diagnostic by switching to rich print and handing the
   health exceptions during exception handling, allowing to print
   detailed logs of what happened
e) the output of `breeze testing docker-compose-tests` is printed
   directly to stdout (with pytest `-s` flag) - so that we see
   the progress of test as it happens - both locally and in CI.
jroachgolf84 pushed a commit to jroachgolf84/airflow that referenced this pull request Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:docker-tests area:production-image Production image improvements and fixes backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch kind:documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants