Skip to content
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

Fix/1550 reset airflow db tests #1554

Closed

Conversation

donotpush
Copy link
Collaborator

Description

Forces Airflow local database reset when running tests.

Related Issues

Copy link

netlify bot commented Jul 6, 2024

Deploy Preview for dlt-hub-docs canceled.

Name Link
🔨 Latest commit f4bbb2f
🔍 Latest deploy log https://app.netlify.com/sites/dlt-hub-docs/deploys/66897c72ceaeca00080aca7c

Copy link
Collaborator

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

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

this looks good! I think all the issues come from a few things we do here and are not directly documented ie. testing with minimal deps.

  1. please read and fix the comments
  2. please resubmit this PR directly to this repo, do not use forks. you have contributor access now. such access allows your PRs to be run with access to all CI secrets
  3. also please do make lint before submitting so linter will pass. for automatic formatting pls use make format

@@ -84,7 +84,7 @@ jobs:
# key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: poetry install --no-interaction --with sentry-sdk
run: poetry install --no-interaction --with sentry-sdk,airflow
Copy link
Collaborator

Choose a reason for hiding this comment

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

please do not add this dependency here. the whole structure of test_common is such that we start with bare deps (sentry-sdk will go out soon as well) and then gradually increase the number of deps.
this is to catch any problems with people assuming certain dependencies exist while the bare library does not support them

in case of this PR we are changing the test code but still we should not affect how other tests are run

@@ -115,4 +115,16 @@ def _create_pipeline_instance_id(self) -> str:
# disable httpx request logging (too verbose when testing qdrant)
logging.getLogger("httpx").setLevel("WARNING")

# reset airflow db
from airflow.utils import db
Copy link
Collaborator

Choose a reason for hiding this comment

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

allow for the import to fail so we do it only when airflow is installed

logging.getLogger(log).setLevel("ERROR")

try:
db.resetdb()
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you take a look at the function below in tests/helpers/airflow_tests/utils.py

def setup_airflow() -> None:

which we use to initialize airflow for our tests. it for example disables loading examples. but maybe it is irrelevant for the simple reset. is there anything we should also do here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think that we need to add anything.

@donotpush
Copy link
Collaborator Author

this looks good! I think all the issues come from a few things we do here and are not directly documented ie. testing with minimal deps.

  1. please read and fix the comments
  2. please resubmit this PR directly to this repo, do not use forks. you have contributor access now. such access allows your PRs to be run with access to all CI secrets
  3. also please do make lint before submitting so linter will pass. for automatic formatting pls use make format

Thanks for the comments and recommendations.

I have openned a second PR with the proper branch: #1559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pytest: airflow database errors during development
2 participants