Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Conversation

@kaxil
Copy link
Collaborator

@kaxil kaxil commented May 19, 2022

We want to make sure that Astro SDK continues working with Airflow 2.2.5 and Airflow 2.3 - so this commit adds this capability in nox.

A problem I foresee is some tests failing intermittently as some of our "integration tests" don't have unique ids for tables, dataset which means there might be times when an integration test is running in 2.2.5 which deletes a resource that is being used by same test running for 2.3.

One "quick" solution is to run them sequentially but that will increase total test time. A better solution will be to fix the tests but that will take time.

@codecov
Copy link

codecov bot commented May 19, 2022

Codecov Report

Merging #370 (a7df2b7) into main (ba4e6bd) will decrease coverage by 2.59%.
The diff coverage is 100.00%.

❗ Current head a7df2b7 differs from pull request most recent head ff88560. Consider uploading reports for the commit ff88560 to get more accurate results

@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
- Coverage   93.04%   90.44%   -2.60%     
==========================================
  Files          57       57              
  Lines        1969     1968       -1     
  Branches      302      302              
==========================================
- Hits         1832     1780      -52     
- Misses        100      144      +44     
- Partials       37       44       +7     
Impacted Files Coverage Δ
src/astro/databases/sqlite.py 100.00% <100.00%> (ø)
src/astro/sql/operators/agnostic_save_file.py 92.15% <100.00%> (ø)
src/astro/sql/operators/sql_dataframe.py 96.34% <100.00%> (ø)
src/astro/sqlite_utils.py 100.00% <100.00%> (ø)
src/astro/utils/database.py 100.00% <100.00%> (ø)
src/astro/utils/delete.py 46.66% <0.00%> (-53.34%) ⬇️
src/astro/files/locations/google/gcs.py 66.66% <0.00%> (-33.34%) ⬇️
src/astro/files/locations/local.py 80.95% <0.00%> (-19.05%) ⬇️
src/astro/files/locations/base.py 77.27% <0.00%> (-18.19%) ⬇️
src/astro/utils/load.py 87.82% <0.00%> (-11.31%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba4e6bd...ff88560. Read the comment docs.

- run: sqlite3 /tmp/sqlite_default.db "VACUUM;"
- run: pip3 install nox
- run: nox -s test -- --splits 12 --group ${{ matrix.group }} --cov=src --cov-report=xml --cov-branch
- run: nox -s unit_test -- --splits 6 --group ${{ matrix.group }} --cov=src --cov-report=xml --cov-branch
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did this change increase the time it takes for the CI to run tests? If yes, in how much?



@nox.session(python=["3.7", "3.8", "3.9"])
@nox.parametrize("airflow", ["2.2.5", "2.3"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is great, @kaxil !

noxfile.py Outdated

@nox.session(python=["3.7", "3.8", "3.9"])
def test(session: nox.Session) -> None:
def unit_test(session: nox.Session) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the split between unit and integration tests!

@tatiana
Copy link
Collaborator

tatiana commented May 19, 2022

@kaxil, once the tests are passing, let's merge this! It is probably worth double-checking that coverage is working as expected after the tests are fixed.

@kaxil kaxil force-pushed the run-tests-multiple-airflow-versions branch from a7df2b7 to ff88560 Compare May 19, 2022 22:07
@tatiana
Copy link
Collaborator

tatiana commented May 20, 2022

@kaxil, how is this going? Do we have any risks that Astro may stop working with previous versions of Airflow if this is not merged sooner than later?

kaxil added a commit that referenced this pull request May 20, 2022
Uses https://docs.pytest.org/en/latest/how-to/usage.html#profiling-test-execution-duration to get a list of slowest 30 tests for which the durations is over 1.0s long.

This is a small change but will help identify if a test takes too long. Found a need to do that while working on #367 and #370
@kaxil
Copy link
Collaborator Author

kaxil commented May 20, 2022

@kaxil, how is this going? Do we have any risks that Astro may stop working with previous versions of Airflow if this is not merged sooner than later?

No risk, until we release a new version and update any libraries in setup.py. Will get to it in a day or two

@kaxil kaxil force-pushed the run-tests-multiple-airflow-versions branch from ff88560 to 3da49fd Compare May 20, 2022 20:58
kaxil added a commit that referenced this pull request May 22, 2022
Uses https://docs.pytest.org/en/latest/how-to/usage.html#profiling-test-execution-duration to get a list of slowest 30 tests for which the durations is over 1.0s long.

This is a small change but will help identify if a test takes too long. Found a need to do that while working on #367 and #370
@kaxil kaxil changed the title Run tests multiple airflow versions Run tests against multiple airflow versions May 23, 2022
@kaxil kaxil added this to the 0.9.0 milestone May 23, 2022
@kaxil kaxil force-pushed the run-tests-multiple-airflow-versions branch from 3da49fd to 83457be Compare May 24, 2022 19:50
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2022

Codecov Report

Merging #370 (c68e9b2) into main (bc634d1) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
+ Coverage   90.45%   90.50%   +0.05%     
==========================================
  Files          53       53              
  Lines        1792     1791       -1     
  Branches      280      279       -1     
==========================================
  Hits         1621     1621              
  Misses        131      131              
+ Partials       40       39       -1     
Impacted Files Coverage Δ
src/astro/sql/operators/export_file.py 93.54% <ø> (ø)
src/astro/utils/table_handler.py 100.00% <100.00%> (+3.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b80c9f...c68e9b2. Read the comment docs.

@kaxil kaxil force-pushed the run-tests-multiple-airflow-versions branch 2 times, most recently from 72a3882 to 55bef50 Compare May 25, 2022 17:27
kaxil added 3 commits May 25, 2022 18:35
This commit allows separately running unit tests and integration tests. Also allows running integration tests with Airflow 2.2.5 and 2.3
These are some tests but there are lot more

Revert "Mark certain tests as integration tests"

This reverts commit f98f185.
@kaxil kaxil force-pushed the run-tests-multiple-airflow-versions branch from 55bef50 to c68e9b2 Compare May 25, 2022 17:35
@kaxil
Copy link
Collaborator Author

kaxil commented May 25, 2022

We want to make sure that Astro SDK continues working with Airflow 2.2.5 and Airflow 2.3 - so this commit adds this capability in nox.

A problem I foresee is some tests failing intermittently as some of our "integration tests" don't have unique ids for tables, dataset which means there might be times when an integration test is running in 2.2.5 which deletes a resource that is being used by same test running for 2.3.

One "quick" solution is to run them sequentially but that will increase total test time. A better solution will be to fix the tests but that will take time.

@kaxil kaxil marked this pull request as ready for review May 25, 2022 17:57
@kaxil kaxil merged commit 1793fa5 into main May 25, 2022
@kaxil kaxil deleted the run-tests-multiple-airflow-versions branch May 25, 2022 18:08
kaxil added a commit that referenced this pull request May 25, 2022
The CI is failing intermittently as I initially suspected in #370

Example: https://github.com/astronomer/astro-sdk/runs/6601723455?check_suite_focus=true

This PR runs 2.2.5 tests after 2.3 tests are complete and also only runs a subset of the tests (Example DAGs and one of the integration tests) for 2.2.5 which should be enough for 2.2.5
kaxil added a commit that referenced this pull request May 26, 2022
The CI is failing intermittently as I initially suspected in #370

Example: https://github.com/astronomer/astro-sdk/runs/6601723455?check_suite_focus=true

This PR runs 2.2.5 tests after 2.3 tests are complete and also only runs a subset of the tests (Example DAGs and one of the integration tests) for 2.2.5 which should be enough for 2.2.5
kaxil added a commit that referenced this pull request May 26, 2022
The CI is failing intermittently as I initially suspected in #370

Example: https://github.com/astronomer/astro-sdk/runs/6601723455?check_suite_focus=true

This PR runs 2.2.5 tests after 2.3 tests are complete and also only runs a subset of the tests (Example DAGs and one of the integration tests) for 2.2.5 which should be enough for 2.2.5
kaxil added a commit that referenced this pull request May 26, 2022
The CI is failing intermittently as I initially suspected in #370

Example: https://github.com/astronomer/astro-sdk/runs/6601723455?check_suite_focus=true

This PR runs 2.2.5 tests after 2.3 tests are complete and also only runs a subset of the tests (Example DAGs and one of the integration tests) for 2.2.5 which should be enough for 2.2.5
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants