Skip to content

Fix flaky test by isolating Maven tests that modify user.home#6574

Merged
jkschneider merged 1 commit intomainfrom
jkschneider/fix-settings-xml-test
Jan 20, 2026
Merged

Fix flaky test by isolating Maven tests that modify user.home#6574
jkschneider merged 1 commit intomainfrom
jkschneider/fix-settings-xml-test

Conversation

@jkschneider
Copy link
Copy Markdown
Member

@jkschneider jkschneider commented Jan 20, 2026

Summary

  • Added @Isolated annotation to MavenSecuritySettingsTest and MavenSettingsTest to prevent flaky test failures

Problem

The rewrite-maven module has parallel test execution enabled. MavenSecuritySettingsTest and MavenSettingsTest modify the global user.home system property during tests. While these classes had @Execution(ExecutionMode.SAME_THREAD), this only prevents tests within the same class from running concurrently—other test classes can still run in parallel.

When ChangePluginGroupIdAndArtifactIdTest ran concurrently with MavenSecuritySettingsTest, it could pick up the modified user.home pointing to a temp directory with an empty .m2 directory, causing an "EOF in prolog" parse error when trying to read settings.xml.

Solution

Added @Isolated annotation to both test classes. This ensures they run completely alone with no other tests executing concurrently across the entire test suite.

MavenSecuritySettingsTest and MavenSettingsTest modify the global
user.home system property during tests. With parallel test execution
enabled, other tests could pick up the modified property pointing to
an empty temp directory, causing parse failures.

Added @isolated annotation to ensure these tests run alone.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jan 20, 2026
@jkschneider jkschneider changed the title Fix flaky test by isolating tests that modify user.home Fix flaky test by isolating Maven tests that modify user.home Jan 20, 2026
@jkschneider jkschneider merged commit 532ff36 into main Jan 20, 2026
2 checks passed
@jkschneider jkschneider deleted the jkschneider/fix-settings-xml-test branch January 20, 2026 18:34
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant