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

Astro CLI fails on dag integrity test for Basehook.get_connection() #1695

Open
3 tasks
GiannisDim8 opened this issue Aug 1, 2024 · 0 comments
Open
3 tasks

Comments

@GiannisDim8
Copy link

Describe the bug

I am trying to test the compatibility of my DAGs before upgrading astronomer runtime to 11.7.0 using the following astro cli command astro dev upgrade-test --runtime-version 11.7.0
In one of my DAGs I am using Basehook.get_connections() to retrieve the connection details from AWS Secrets manager
I receive the below error during the integrity test. The same error appears regardless of the runtime-version param.

============================= test session starts ==============================
platform linux -- Python 3.11.9, pytest-7.4.4, pluggy-1.5.0
rootdir: /usr/local/airflow
plugins: metadata-3.1.1, html-4.1.1, time-machine-2.14.1, anyio-4.4.0
collected 30 items

.astro/test_dag_integrity_default.py F.............................      [100%]

=================================== FAILURES ===================================
_____________ test_file_imports[dags/negative_balance_emailer.py] ______________

rel_path = 'dags/negative_balance_emailer.py'
rv = 'Traceback (most recent call last):\n  File "/usr/local/lib/python3.11/site-packages/airflow/models/dag.py", line 4074...^^^^^^^^^^^^^^^^^^^^\nTypeError: basehook_get_connection_monkeypatch() missing 1 required positional argument: \'key\''

    @pytest.mark.parametrize(
        "rel_path, rv", get_import_errors(), ids=[x[0] for x in get_import_errors()]
    )
    def test_file_imports(rel_path, rv):
        """Test for import errors on a file"""
        if rv != "No import errors":
            # If rv is not "No import errors," consider it a failed test
>           raise Exception(f"{rel_path} failed to import with message \n {rv}")
E           Exception: dags/negative_balance_emailer.py failed to import with message
E            Traceback (most recent call last):
E             File "/usr/local/lib/python3.11/site-packages/airflow/models/dag.py", line 4074, in factory
E               f(**f_kwargs)
E             File "/usr/local/airflow/dags/negative_balance_emailer.py", line 31, in negative_balance_emailer
E               redshift_conn = BaseHook.get_connection(conn_id="test")
E                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           TypeError: basehook_get_connection_monkeypatch() missing 1 required positional argument: 'key'

.astro/test_dag_integrity_default.py:134: Exception
---- Generated html report: file:///usr/local/airflow/dag-test-report.html -----
=========================== short test summary info ============================
FAILED .astro/test_dag_integrity_default.py::test_file_imports[dags/negative_balance_emailer.py]
========================= 1 failed, 29 passed in 2.65s =========================
See above for errors detected in your DAGs

What CLI Version did you experience this bug?

Astro CLI Version: 1.28.1

This CLI bug is related to which Astronomer Platform?

  • Astro
  • Software
  • None/Unknown

What Operating System is the above CLI installed on?
Mac

🪜 Steps To Reproduce

  1. Create a DAG that uses Basehook.get_connection()
  2. Run the following cli command astro dev upgrade-test --runtime-version 11.7.0
  3. See error
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

No branches or pull requests

1 participant