Skip to content

Commit 0a2f8cb

Browse files
authored
[v3-0-test] Use env var connections instead of mocks in kube system tests (#54261) (#54320)
* Use env var connections instead of mocks in kube system tests * adding right pytest plugings * adding right pytest plugings * adding right pytest plugings (cherry picked from commit d410915)
1 parent 06f37b3 commit 0a2f8cb

File tree

2 files changed

+65
-48
lines changed

2 files changed

+65
-48
lines changed

kubernetes-tests/tests/kubernetes_tests/conftest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,20 @@ def pod_template() -> Path:
3838
@pytest.fixture
3939
def basic_pod_template() -> Path:
4040
return (DATA_FILES_DIRECTORY / "basic_pod.yaml").resolve(strict=True)
41+
42+
43+
@pytest.fixture
44+
def create_connection_without_db(monkeypatch):
45+
"""
46+
Fixture to create connections for tests without using the database.
47+
48+
This fixture uses monkeypatch to set the appropriate AIRFLOW_CONN_{conn_id} environment variable.
49+
"""
50+
51+
def _create_conn(connection, session=None):
52+
"""Create connection using environment variable."""
53+
54+
env_var_name = f"AIRFLOW_CONN_{connection.conn_id.upper()}"
55+
monkeypatch.setenv(env_var_name, connection.as_json())
56+
57+
return _create_conn

0 commit comments

Comments
 (0)