This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 0823e7ad189 Fix flaky SimpleAuthManager login tests under parallel
runs (#68498)
0823e7ad189 is described below
commit 0823e7ad189379fd0e474473326121cdac938aa1
Author: Shahar Epstein <[email protected]>
AuthorDate: Sat Jun 13 11:13:36 2026 +0300
Fix flaky SimpleAuthManager login tests under parallel runs (#68498)
The SimpleAuthManager tests shared a single generated-password file path
under AIRFLOW_HOME across all test processes. Fixtures and tests create,
overwrite, and delete that file, so under parallel (xdist) runs one process
could delete the file another was mid-read on, raising FileNotFoundError
(e.g. test_create_token_invalid_user_password hitting get_passwords).
Isolate the password file per test via the existing
[core] simple_auth_manager_passwords_file config option, pointing it at a
per-test tmp_path so each test (and worker) gets its own file.
---
.../unit/api_fastapi/auth/managers/simple/conftest.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git
a/airflow-core/tests/unit/api_fastapi/auth/managers/simple/conftest.py
b/airflow-core/tests/unit/api_fastapi/auth/managers/simple/conftest.py
index 92cc89f581f..122e8a35cbe 100644
--- a/airflow-core/tests/unit/api_fastapi/auth/managers/simple/conftest.py
+++ b/airflow-core/tests/unit/api_fastapi/auth/managers/simple/conftest.py
@@ -31,6 +31,22 @@ from airflow.api_fastapi.auth.managers.simple.user import
SimpleAuthManagerUser
from tests_common.test_utils.config import conf_vars
[email protected](autouse=True)
+def isolated_password_file(tmp_path):
+ """
+ Point the SimpleAuthManager generated-password file at a per-test path.
+
+ By default the file lives under ``AIRFLOW_HOME``, a single path shared by
every
+ test process. Fixtures and tests here create, overwrite, and delete it, so
under
+ parallel (xdist) runs one process can delete the file another is mid-read
on,
+ raising ``FileNotFoundError``. Giving each test its own ``tmp_path`` file
removes
+ that cross-process race.
+ """
+ password_file = tmp_path / "simple_auth_manager_passwords.json.generated"
+ with conf_vars({("core", "simple_auth_manager_passwords_file"):
str(password_file)}):
+ yield
+
+
@pytest.fixture
def auth_manager():
auth_manager = SimpleAuthManager()