Repository navigation
Fix airflowctl retry env-var tests failing on self-hosted runners - #73212
Merged
Merged
Conversation
The module-wide autouse fixture clears os.environ, so the retry tests handed a child interpreter an environment with nothing but AIRFLOW_HOME. A Python built with --enable-shared then cannot locate libpython unless LD_LIBRARY_PATH survives, which is exactly what actions/setup-python relies on outside /opt/hostedtoolcache. The tests only passed on GitHub-hosted runners because the hardcoded RPATH happened to resolve. Override the fixture for that class so the child inherits a real environment, and drop only the AIRFLOW_CLI_API_* knobs under test so a developer's shell cannot influence the result.
shahar1
requested review from
bugraoz93,
dheerajturaga,
henry3260 and
potiuk
as code owners
September 15, 2026 17:44
SameerMesiah97
approved these changes
Sep 15, 2026
SameerMesiah97
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me save for one unrelated CI failure. Also, just had a question I would hope you could answer as a maintainer.
Contributor
Backport successfully created: airflow-ctl/v0-1-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
github-actions Bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
Sep 15, 2026
… self-hosted runners (apache#73212) The module-wide autouse fixture clears os.environ, so the retry tests handed a child interpreter an environment with nothing but AIRFLOW_HOME. A Python built with --enable-shared then cannot locate libpython unless LD_LIBRARY_PATH survives, which is exactly what actions/setup-python relies on outside /opt/hostedtoolcache. The tests only passed on GitHub-hosted runners because the hardcoded RPATH happened to resolve. Override the fixture for that class so the child inherits a real environment, and drop only the AIRFLOW_CLI_API_* knobs under test so a developer's shell cannot influence the result. (cherry picked from commit b6f61b5) Co-authored-by: Shahar Epstein <[email protected]>
shahar1
added a commit
that referenced
this pull request
Sep 15, 2026
… self-hosted runners (#73212) (#73223) The module-wide autouse fixture clears os.environ, so the retry tests handed a child interpreter an environment with nothing but AIRFLOW_HOME. A Python built with --enable-shared then cannot locate libpython unless LD_LIBRARY_PATH survives, which is exactly what actions/setup-python relies on outside /opt/hostedtoolcache. The tests only passed on GitHub-hosted runners because the hardcoded RPATH happened to resolve. Override the fixture for that class so the child inherits a real environment, and drop only the AIRFLOW_CLI_API_* knobs under test so a developer's shell cannot influence the result. (cherry picked from commit b6f61b5) Co-authored-by: Shahar Epstein <[email protected]>
1 task done
shahar1
added a commit
that referenced
this pull request
Nov 19, 2026
… self-hosted runners (#73212) (#73223) The module-wide autouse fixture clears os.environ, so the retry tests handed a child interpreter an environment with nothing but AIRFLOW_HOME. A Python built with --enable-shared then cannot locate libpython unless LD_LIBRARY_PATH survives, which is exactly what actions/setup-python relies on outside /opt/hostedtoolcache. The tests only passed on GitHub-hosted runners because the hardcoded RPATH happened to resolve. Override the fixture for that class so the child inherits a real environment, and drop only the AIRFLOW_CLI_API_* knobs under test so a developer's shell cannot influence the result. (cherry picked from commit b6f61b5) Co-authored-by: Shahar Epstein <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human Summary
The module-level
unique_config_dirfixture was accidentally replacing the entire environment with justAIRFLOW_HOMEbefore starting a second Python process.When running on self-hosted runners (currently WIIP), this dropped
LD_LIBRARY_PATH, which theactions/setup-pythoninterpreter needs to find its shared libraries.The fix was to make this test class preserve the normal environment, point
AIRFLOW_HOMEto a temporary directory, and clear only the specificAIRFLOW_CLI_API_*variables being tested. Other tests still use the fully isolated environment.AI Summary
Click Here
The autouse `unique_config_dir` fixture in `test_client.py` runs `patch.dict(os.environ, ..., clear=True)`, so `TestRetryConfigurationEnvVars` spawned its child interpreter with an environment containing only `AIRFLOW_HOME` (no `PATH`, no `LD_LIBRARY_PATH`).A Python installed by
actions/setup-pythonis built--enable-sharedwith an RPATH pointing at/opt/hostedtoolcache/.... On GitHub-hosted runners that path exists, so the child started by luck. On a self-hosted runner the toolcache lives elsewhere and the interpreter depends on theLD_LIBRARY_PATHthatsetup-pythonexports, so the child died before importing anything:This overrides the fixture at class scope: the child inherits the real environment, and only the
AIRFLOW_CLI_API_*knobs under test are removed so a developer's shell values cannot skew the expected results. The rest of the module keeps the strict cleared environment.Verified with
--setup-showthat the class-level override is the fixture that runs, and the full module passes under-n 4.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5.1) following the guidelines
🤖 Generated with Claude Code