-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Improve testing harness to separate DB and non-DB tests #35160
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boring-cyborg
bot
added
area:CLI
area:dev-tools
area:Triggerer
area:webserver
Webserver related Issues
labels
Oct 24, 2023
Devlist proposal coming based on that one. |
potiuk
force-pushed
the
pure-unit-tests
branch
from
October 24, 2023 19:08
8893780
to
11dfd6d
Compare
potiuk
changed the title
Add support for pure unit tests
Add support for marking tests as DB tests
Oct 24, 2023
potiuk
force-pushed
the
pure-unit-tests
branch
20 times, most recently
from
October 26, 2023 13:19
53ec866
to
58540c9
Compare
1 task
This PR marks DB tests as such and allows to split execution of the tests in CI to run the DB tests with the various database while the non-db tests - without the DB in a separate run. In order to do that, the code to select which tests to run has been moved from `entrypoint_ci.sh` bash to breeze's Python code, which is generally much nicer to maintain and common for both "DB" and "non-DB" tests. This will have the nice side effect that it will be easier in the future to manage different test types and contain some specific flaky test types. This change also adds possibility to isolate some of the test types when parallel DB tests are run and adds new test type PythonOperator carved out Operator type. This test is best run in isolation becasue creating and destroing virtualenvs in Docker while running in parallel to other tests is very slow for some reason and leads to flaky tests. Python operator tests are therefore separated out from Operators and treated separately as isolated tests. This will help not only with speed but also with stability of the test suite.
potiuk
force-pushed
the
pure-unit-tests
branch
from
October 31, 2023 19:02
17e84c8
to
801a808
Compare
BOOM ,, MERGED |
potiuk
added
the
area:dev-env
CI, pre-commit, pylint and other changes that do not change the behavior of the final code
label
Nov 1, 2023
ephraimbuddy
added
the
type:misc/internal
Changelog: Misc changes that should appear in change log
label
Nov 1, 2023
ephraimbuddy
pushed a commit
that referenced
this pull request
Nov 1, 2023
This PR is separated out from #35160 in order to make the big refactor and splitting out our test harness to DB and Non-DB tests far more easy to review. This change contains purely adding db_tests markers to the tests that need them, and as such it requires very litte effort to review. Once this one is merged hoever, the #35160 will become way smaller in terms of number of files to review, which will make it far easier to review using GitHub Interface. (cherry picked from commit 1aa91a4)
ephraimbuddy
pushed a commit
that referenced
this pull request
Nov 1, 2023
This PR marks DB tests as such and allows to split execution of the tests in CI to run the DB tests with the various database while the non-db tests - without the DB in a separate run. In order to do that, the code to select which tests to run has been moved from `entrypoint_ci.sh` bash to breeze's Python code, which is generally much nicer to maintain and common for both "DB" and "non-DB" tests. This will have the nice side effect that it will be easier in the future to manage different test types and contain some specific flaky test types. This change also adds possibility to isolate some of the test types when parallel DB tests are run and adds new test type PythonOperator carved out Operator type. This test is best run in isolation becasue creating and destroing virtualenvs in Docker while running in parallel to other tests is very slow for some reason and leads to flaky tests. Python operator tests are therefore separated out from Operators and treated separately as isolated tests. This will help not only with speed but also with stability of the test suite. (cherry picked from commit a7e76ba)
40 tasks
potiuk
added a commit
that referenced
this pull request
Nov 4, 2023
Turns out that some of the layers in our PROD image got invalidated because AIRFLOW_CONSTRAINTS_MODE used to build the cache for PROD image is "constraints" by default, while building images in "build-images" workflow for regular PRs and canary build uses "constraints-source-providers". The former is fine as default for PROD image (as oppose to CI image we build PROD image from released PyPI packages by default) but the latter is "proper" for the CI cache, because there, the image is built out of local packages prepared from sources. Turns out that the CONSTRAINT_MODE parameter had a profound impact on caching - because it was set before the "install_packages_from_branch_tip" step and - in fact - even before "install database clients" step, which caused our cache to only work for the "base OS dependencies" - installing database clients and installing airflow from branch tip (which works great for CI image) had always been done in PRs because the layers in cache with constraints env invalidated all subsequent layers. This had no big impact before when testing usually took much longer time - but since the testing has been vastly improved in #35160, now PROD image building continues running even after test complete and becomes the next frontier of optimization. This PR optimizes PROD image building in two ways: * caching is prepared with "source_providers" constraint mode, same as regular build * the AIRFLOW_CONSTRAINT_MODE and related arguments are moved after installing database clients, so that this parameter does not impact their caching.
potiuk
added a commit
that referenced
this pull request
Nov 4, 2023
Turns out that some of the layers in our PROD image got invalidated because AIRFLOW_CONSTRAINTS_MODE used to build the cache for PROD image is "constraints" by default, while building images in "build-images" workflow for regular PRs and canary build uses "constraints-source-providers". The former is fine as default for PROD image (as oppose to CI image we build PROD image from released PyPI packages by default) but the latter is "proper" for the CI cache, because there, the image is built out of local packages prepared from sources. Turns out that the CONSTRAINT_MODE parameter had a profound impact on caching - because it was set before the "install_packages_from_branch_tip" step and - in fact - even before "install database clients" step, which caused our cache to only work for the "base OS dependencies" - installing database clients and installing airflow from branch tip (which works great for CI image) had always been done in PRs because the layers in cache with constraints env invalidated all subsequent layers. This had no big impact before when testing usually took much longer time - but since the testing has been vastly improved in #35160, now PROD image building continues running even after test complete and becomes the next frontier of optimization. This PR optimizes PROD image building in two ways: * caching is prepared with "source_providers" constraint mode, same as regular build * the AIRFLOW_CONSTRAINT_MODE and related arguments are moved after installing database clients, so that this parameter does not impact their caching.
romsharon98
pushed a commit
to romsharon98/airflow
that referenced
this pull request
Nov 10, 2023
This PR marks DB tests as such and allows to split execution of the tests in CI to run the DB tests with the various database while the non-db tests - without the DB in a separate run. In order to do that, the code to select which tests to run has been moved from `entrypoint_ci.sh` bash to breeze's Python code, which is generally much nicer to maintain and common for both "DB" and "non-DB" tests. This will have the nice side effect that it will be easier in the future to manage different test types and contain some specific flaky test types. This change also adds possibility to isolate some of the test types when parallel DB tests are run and adds new test type PythonOperator carved out Operator type. This test is best run in isolation becasue creating and destroing virtualenvs in Docker while running in parallel to other tests is very slow for some reason and leads to flaky tests. Python operator tests are therefore separated out from Operators and treated separately as isolated tests. This will help not only with speed but also with stability of the test suite.
romsharon98
pushed a commit
to romsharon98/airflow
that referenced
this pull request
Nov 10, 2023
Turns out that some of the layers in our PROD image got invalidated because AIRFLOW_CONSTRAINTS_MODE used to build the cache for PROD image is "constraints" by default, while building images in "build-images" workflow for regular PRs and canary build uses "constraints-source-providers". The former is fine as default for PROD image (as oppose to CI image we build PROD image from released PyPI packages by default) but the latter is "proper" for the CI cache, because there, the image is built out of local packages prepared from sources. Turns out that the CONSTRAINT_MODE parameter had a profound impact on caching - because it was set before the "install_packages_from_branch_tip" step and - in fact - even before "install database clients" step, which caused our cache to only work for the "base OS dependencies" - installing database clients and installing airflow from branch tip (which works great for CI image) had always been done in PRs because the layers in cache with constraints env invalidated all subsequent layers. This had no big impact before when testing usually took much longer time - but since the testing has been vastly improved in apache#35160, now PROD image building continues running even after test complete and becomes the next frontier of optimization. This PR optimizes PROD image building in two ways: * caching is prepared with "source_providers" constraint mode, same as regular build * the AIRFLOW_CONSTRAINT_MODE and related arguments are moved after installing database clients, so that this parameter does not impact their caching.
potiuk
added a commit
to potiuk/airflow
that referenced
this pull request
Dec 22, 2023
When the DB/NonDB tests were introduced (apache#35160) new test types have been added (separating various Python test types from generic Operator test type). However we have not added matching of the python operator and test files into the right selective unit test type. This caused that when only `operators/python.py` and `tests/test_python` were changed, then `Operators` test type was run but the specific Python * test types were not run. This PR fixes it for current test type (including also separated Serialization test type) and for the future - instead of matching selected test type we match all of them except the few that we now are "special" ("Always, Core, Other, PlainAsserts").
potiuk
added a commit
that referenced
this pull request
Dec 22, 2023
…#36372) When the DB/NonDB tests were introduced (#35160) new test types have been added (separating various Python test types from generic Operator test type). However we have not added matching of the python operator and test files into the right selective unit test type. This caused that when only `operators/python.py` and `tests/test_python` were changed, then `Operators` test type was run but the specific Python * test types were not run. This PR fixes it for current test type (including also separated Serialization test type) and for the future - instead of matching selected test type we match all of them except the few that we now are "special" ("Always, Core, Other, PlainAsserts").
potiuk
added a commit
that referenced
this pull request
Dec 30, 2023
…#36372) When the DB/NonDB tests were introduced (#35160) new test types have been added (separating various Python test types from generic Operator test type). However we have not added matching of the python operator and test files into the right selective unit test type. This caused that when only `operators/python.py` and `tests/test_python` were changed, then `Operators` test type was run but the specific Python * test types were not run. This PR fixes it for current test type (including also separated Serialization test type) and for the future - instead of matching selected test type we match all of them except the few that we now are "special" ("Always, Core, Other, PlainAsserts"). (cherry picked from commit b0db1f9)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:CLI
area:dev-env
CI, pre-commit, pylint and other changes that do not change the behavior of the final code
area:dev-tools
area:Triggerer
area:webserver
Webserver related Issues
type:misc/internal
Changelog: Misc changes that should appear in change log
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR marks DB tests as such and allows to split execution
of the tests in CI to run the DB tests with the various database
while the non-db tests - without the DB in a separate run.
In order to do that, the code to select which tests to run has been
moved from
entrypoint_ci.sh
bash to breeze's Python code, which isgenerally much nicer to maintain and common for both "DB" and
"non-DB" tests.
This will have the nice side effect that it will be easier in the
future to manage different test types and contain some specific
flaky test types.
This change also adds possibility to isolate some of the test types
when parallel DB tests are run and adds new test type
PythonOperator carved out Operator type. This test is best run in
isolation becasue creating and destroing virtualenvs in Docker while
running in parallel to other tests is very slow for some reason and
leads to flaky tests.
Python operator tests are therefore separated out from Operators and
treated separately as isolated tests.
This will help not only with speed but also with stability of the
test suite.
^ 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.