🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

test(maven): isolate HOME to stop tests reading ~/.m2/settings.xml - #10875

Merged
olblak merged 2 commits into
updatecli:mainfrom
lemeurherve:fix-maven-autodiscovery-tests
Oct 17, 2026
Merged

olblak merged 2 commits into
updatecli:mainfrom
lemeurherve:fix-maven-autodiscovery-tests

Conversation

@lemeurherve

@lemeurherve lemeurherve commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Fix:

Test

To test this pull request, you can run the following commands:

cd <to_package_directory>
go test

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.
  • I have tested this pull request manually with a custom Updatecli build and it works as expected.

Tradeoff

Potential improvement

Summary by CodeRabbit

  • Tests
    • Maven autodiscovery tests now run with an isolated temporary home directory.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20415f66-4788-42f3-bacb-192958c8cdd2
📥 Commits

Reviewing files that changed from the base of the PR and between e078fed and ca704a8.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e487796-2824-4079-ae85-8b56cd70c524
📥 Commits

Reviewing files that changed from the base of the PR and between b6ec282 and e078fed.

📒 Files selected for processing: 1
  • pkg/plugins/autodiscovery/maven/main_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The Maven autodiscovery package tests now run with a temporary home directory and without MAVEN_HOME or M2_HOME set.

Changes: Maven test environment isolation

Layer / File(s) Summary
Isolate Maven test environment
pkg/plugins/autodiscovery/maven/main_test.go
TestMain sets a temporary HOME, unsets MAVEN_HOME and M2_HOME, runs the tests, and removes the temporary directory.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: olblak

Merge Risk: ⚪ Minimal · up to e078f

The tests use a temporary HOME for Maven settings lookup, preventing the caller’s settings file from interfering. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description includes the issue reference and template headings, but it does not describe the implemented change. The test command still uses the placeholder package path, and the tradeoff and pote… Add a brief summary of the HOME, MAVEN_HOME, and M2_HOME test isolation changes. Replace <to_package_directory> with the actual package path. Complete the Tradeoff and Potential improvement sections, or state that no tradeoffs or improvemen…
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the Maven test isolation change and the reason for it. It is concise and directly matches the pull request changes.
Linked Issues check Passed The PR addresses [#10872]. pkg/plugins/autodiscovery/maven/main_test.go adds package-level TestMain. It sets HOME to a new temporary directory before m.Run, and unsets MAVEN_HOME and `M2_HOM…
Out of Scope Changes check Passed The whole-PR diff contains only test setup changes in pkg/plugins/autodiscovery/maven/main_test.go. The changes directly support the linked issue by isolating Maven configuration during tests. No un…
Full details: Description check

Explanation

The description includes the issue reference and template headings, but it does not describe the implemented change. The test command still uses the placeholder package path, and the tradeoff and potential improvement sections are empty.

Resolution

Add a brief summary of the HOME, MAVEN_HOME, and M2_HOME test isolation changes. Replace <to_package_directory> with the actual package path. Complete the Tradeoff and Potential improvement sections, or state that no tradeoffs or improvements apply.

✨ Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@olblak
olblak enabled auto-merge (squash) October 17, 2026 12:24
@olblak olblak added resource-mavenrepository Resource of kind Maven Repository refactor labels Oct 17, 2026
@olblak
olblak merged commit e336684 into updatecli:main Oct 17, 2026
8 checks passed
@olblak olblak added the chore label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore refactor resource-mavenrepository Resource of kind Maven Repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants