-
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
[AIRFLOW-6763] Make systems tests ready for backport tests #7389
[AIRFLOW-6763] Make systems tests ready for backport tests #7389
Conversation
@nuclearpinguin @mik-laj (and @ashb / @kaxil ) - this is a change that makes it very easy to run system tests using pytest's markers in the breeze/CI environment. We will use it to test all the backported 2.0 packages on older airlfow versions. For now for Google/GCP for which we have system tests integrated, but it's very generic and we can apply it for other systems as well as we will have a possibility to run the system tests automatically in the future when we move to github actions. |
d844348
to
ac55753
Compare
I've skimmed the changes and they look fine, but I don't see how this is connected to testing backported operators? |
(i.e. why the system bit, Vs unit test is needed to check the backport) |
I am writing devlist message shortly about it. |
Codecov Report
@@ Coverage Diff @@
## master #7389 +/- ##
==========================================
+ Coverage 86.26% 86.69% +0.43%
==========================================
Files 877 877
Lines 41221 41242 +21
==========================================
+ Hits 35559 35755 +196
+ Misses 5662 5487 -175
Continue to review full report at Codecov.
|
e6faaed
to
1630c44
Compare
@ashb > (i.e. why the system bit, Vs unit test is needed to check the backport) The backported packages are already unit-tested. They are copied straight from the master where the unit tests have been run and are green in CI. There is basically no easy way - unless you want to rewrite manually all the tests - to run unit tests with back-ported operators/hooks/sensors from 2.0 in the context of Airlfow 1.10. I at least could not find any way to do it easily - but if you think you can do it easily, it would be great. I just think it is awfully lot of effort. Many of the unit tests use mocking for internal structure of packages and it would not work to convert those. And it would not make a lot of sense because we would just (again) test the same - behaviors of the operators - pretty much all the "operators/hooks/sensors" test are mocking out the communication to the external systems and test internal logic of the operators. We do not need to test it again - we know that this works. What we do not know if the operators are working with airflow-1.10 framework and whether the framework changes did not spoil anything. So we really need to test integration of the operators from 2.0 to 1.10 and the best we can do here is to run those (already unit-tested) operators in the context of 1.10 talking to the real system and see if they are still working there. We have a lot of such tests for GCP and we can fairly easiy test those 2.0 operators to run on top of airflow 1.10.x. Which is really what we want to know. |
@ashb -> one more thing. With few more breeze's modifications, It will actually be possible (bear with me) to also run unit tests with the old version of airflow. I plan to make it super easy to remove "sources" of airflow but leave tests and install any old version of Airflow inside the breeze docker. That will - in theory make it possible to run the "unit" and "integration" tests against old version of Airflow. But I am afraid due to this mocking it will not really work in many cases. |
1630c44
to
a51b9aa
Compare
Hello @ashb @mik-laj @nuclearpinguin @kaxil @dimberman -> I updated the implementation now and it works really nicely. Breeze is now turned into "airflow_1.10." testing playground. It will be super-useful to automatically run system tests (currently only for google/ operators) using the latests tests and "example_dags" from "providers", but using the installed airflow version. You can run There is an easy way to test installation and run system tests of the released "backported" providers package. If you have binary wheel "providers" package prepared locally or downloaded, you just need to copy the wheel package to "files" dir. You can download it from the latest build of teh Then inside the container with installed airflow version you should be able to run: The "/opt/airflow/tests" folders and "/providers" folders are mapped into the container (and system test class handles it properly) so that we can still modify the tests locally and run them with airflow 1.10.*. For example, right after installing the 'providers' package you should be able to run:
It will work for both - 2.0 and 1.10.* series providing that you have proper GCP credentials in "files/airflow-breeze-config/variables.env" |
a51b9aa
to
1213b27
Compare
Hey @ashb @mik-laj @nuclearpinguin -> all green for the system tests ready for backporting. BTW, I upladed the docs and added "How to write system tests" doc... |
Ping. |
Does this fall under AIP-4? That is still draft. Should we vote on that AIP? |
Sure. I can start a discussion and vote on it - but I think we could merge that one independently (and show it as an example) - for now it's limited only to GCP but it can show others how it can be done in an easy way. I believe AIP-4 is is much more about running the System Tests in automated way rather than separating them out (and it requires Github Actions move to be completed and some serious discussion on how to store credentials). We've already added some separation (skipIfs, _system.py in GCP) - now we have a generic mechanism but it does not mean we introduce it in "global way" yet. I think it's best if we merge this one first and then I could start a discussion on how to make the AIP-4 automation working. Actually i wanted to start another discussion right after about involving the community to add system tests to all other provider packages - so that we can automate it with AIP-4 as well. So the discussion might be quite big - having a working, generic implementation in GCP that is generic enough to be reused and to show how it works manually is a great way for people to take part in the discussion. So for me this is more of an enabler for AIP-4 discussion to happen. WDYT @ashb ? |
f577fd3
to
9751b69
Compare
It's a big change but it looks good to me from what I see :) |
9751b69
to
8409e95
Compare
We will run system test on back-ported operators for 1.10* series of airflow and for that we need to have support for running system tests using pytest's markers and reading environment variables passed from HOST machine (to pass credentials). This is the first step to automate system tests execution.
feae6b3
to
542d257
Compare
rebased and hopefully all good now. |
also applied the comments from @efedotova ! |
We will run system test on back-ported operators for 1.10* series of airflow and for that we need to have support for running system tests using pytest's markers and reading environment variables passed from HOST machine (to pass credentials). This is the first step to automate system tests execution. (cherry picked from commit 848fbab)
We will run system test on back-ported operators for 1.10* series of airflow and for that we need to have support for running system tests using pytest's markers and reading environment variables passed from HOST machine (to pass credentials). This is the first step to automate system tests execution.
We will run system test on back-ported operators for 1.10* series of airflow and for that we need to have support for running system tests using pytest's markers and reading environment variables passed from HOST machine (to pass credentials). This is the first step to automate system tests execution. (cherry picked from commit 848fbab)
We will run system test on back-ported operators for 1.10* series of airflow and for that we need to have support for running system tests using pytest's markers and reading environment variables passed from HOST machine (to pass credentials). This is the first step to automate system tests execution. (cherry picked from commit 848fbab)
We will run system test on back-ported operators for 1.10* series of airflow
and for that we need to have support for running system tests using pytest's
markers and reading environment variables passed from HOST machine (to pass
credentials).
This is the first step to automate system tests execution.
Issue link: AIRFLOW-6763
Make sure to mark the boxes below before creating PR: [x]
[AIRFLOW-NNNN]
. AIRFLOW-NNNN = JIRA ID** For document-only changes commit message can start with
[AIRFLOW-XXXX]
.In case of fundamental code change, 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 UPDATING.md.
Read the Pull Request Guidelines for more information.