Taragolis commented on code in PR #33422: URL: https://github.com/apache/airflow/pull/33422#discussion_r1295732302
########## tests/core/test_impersonation_tests.py: ########## @@ -84,15 +113,48 @@ def create_user(check_original_docker_image): f"{command!r} without a password prompt (check sudoers file)?\n" f"{e.stdout.decode() if e.stdout else ''}" ) - yield + yield TEST_USER subprocess.check_call(["sudo", "userdel", "-r", TEST_USER]) +@pytest.fixture +def create_airflow_home(create_user, tmp_path, monkeypatch): + sql_alchemy_conn = conf.get_mandatory_value("database", "sql_alchemy_conn") + username = create_user + airflow_home = tmp_path / "airflow-home" + + if not airflow_home.exists(): + airflow_home.mkdir(parents=True, exist_ok=True) + + permissions = { + # By default, ``tmp_path`` save temporary files/directories in user temporary directory + # something like: `/tmp/pytest-of-root` and other users might be limited to access to it, + # so we need to grant at least r/o access to everyone. + airflow_home: 0o777, + # Grant full access to system-wide temporary directory (if for some reason it not set) + tempfile.gettempdir(): 0o777, + } + + if sql_alchemy_conn.lower().startswith("sqlite"): + sqlite_file = Path(sql_alchemy_conn.replace("sqlite:///", "")) + # Grant r/w access to sqlite file. + permissions[sqlite_file] = 0o766 + # Grant r/w access to directory where sqlite file placed + # otherwise we can't create temporary files during write access. + permissions[sqlite_file.parent] = 0o777 Review Comment: This just dummy solution, we grant r/w access to `/root/airflow/sqlite` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org