Skip to content

chore(ci): Clean up env variable leak in TestSqlConf#18486

Merged
voonhous merged 2 commits into
apache:masterfrom
geserdugarov:clean-env-var-in-test
Apr 9, 2026
Merged

chore(ci): Clean up env variable leak in TestSqlConf#18486
voonhous merged 2 commits into
apache:masterfrom
geserdugarov:clean-env-var-in-test

Conversation

@geserdugarov
Copy link
Copy Markdown
Contributor

Describe the issue this Pull Request addresses

TestSqlConf changes the JVM's environment variable map, but does not revert those changes in the end.
In a result, any test class, which will call DFSPropertiesConfiguration::refreshGlobalProps after, would load from the test's external-config/hudi-defaults.conf instead of the default path.

Summary and Changelog

Clean up environment variable map after TestSqlConf is done.

Impact

No

Risk Level

None

Documentation Update

None

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@geserdugarov geserdugarov marked this pull request as ready for review April 9, 2026 06:16
@geserdugarov geserdugarov changed the title chore(ci): Clean up env variable leak in TestSqlConf chore(ci): Clean up env variable leak in TestSqlConf Apr 9, 2026
Copy link
Copy Markdown
Contributor

@yihua yihua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Style & Readability Review — code looks clean overall, but one readability issue: the magic field name "m" in the reflection call needs clarification via a comment.

}

def unsetEnv(key: String): String = {
val field = System.getenv().getClass.getDeclaredField("m")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 nit: the field name "m" is a magic constant referring to JDK internals — could you add a comment explaining it's the internal map field of System.getenv()?

- Generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Copy link
Copy Markdown
Contributor

@yihua yihua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

LGTM — clean, minimal fix that correctly mirrors the existing setEnv reflection pattern to undo the environment variable side-effect, preventing leakage into subsequent test classes.

@geserdugarov geserdugarov requested a review from yihua April 9, 2026 06:45
@github-actions github-actions Bot added the size:S PR with lines of changes in (10, 100] label Apr 9, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.79%. Comparing base (eaa9c8b) to head (0f73222).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18486      +/-   ##
============================================
+ Coverage     68.78%   68.79%   +0.01%     
- Complexity    28126    28169      +43     
============================================
  Files          2452     2459       +7     
  Lines        135059   135114      +55     
  Branches      16385    16380       -5     
============================================
+ Hits          92894    92952      +58     
- Misses        34798    34799       +1     
+ Partials       7367     7363       -4     
Flag Coverage Δ
common-and-other-modules 44.46% <ø> (+0.02%) ⬆️
hadoop-mr-java-client 44.86% <ø> (+0.01%) ⬆️
spark-client-hadoop-common 48.39% <ø> (+<0.01%) ⬆️
spark-java-tests 48.89% <ø> (+0.02%) ⬆️
spark-scala-tests 45.49% <ø> (+<0.01%) ⬆️
utilities 38.20% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hudi-bot
Copy link
Copy Markdown
Collaborator

hudi-bot commented Apr 9, 2026

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Copy link
Copy Markdown
Contributor

@yihua yihua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

LGTM — nice follow-up! The previous review had no open findings, and this update cleanly extracts the magic string "m" into a named constant with a descriptive comment, making the reflection intent much clearer to future readers. No new issues introduced.

Copy link
Copy Markdown
Member

@voonhous voonhous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@voonhous voonhous merged commit 88c146e into apache:master Apr 9, 2026
56 checks passed
@geserdugarov geserdugarov deleted the clean-env-var-in-test branch April 10, 2026 05:10
rahil-c pushed a commit to rahil-c/hudi that referenced this pull request Apr 20, 2026
* chore(ci): Clean up env variable leak in `TestSqlConf`

* clarify magic field name
dwshmilyss pushed a commit to dwshmilyss/hudi that referenced this pull request May 21, 2026
* chore(ci): Clean up env variable leak in `TestSqlConf`

* clarify magic field name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants