Maven: pin the repository in two mirror-sensitive failure tests - #8666
Open
Niloyyy wants to merge 1 commit into
Open
Maven: pin the repository in two mirror-sensitive failure tests#8666Niloyyy wants to merge 1 commit into
Niloyyy wants to merge 1 commit into
Conversation
AddDependencyTest.dontAddDuplicateIfUpdateModelOnPriorRecipeCycleFailed and MavenDependencyFailuresTest.unresolvableMavenMetadata have been @disabled since openrewrite#7566. Both assert on a concrete repository URL, and a configured mirror rewrites it: -https://repo.maven.apache.org/maven2: HTTP 404 +<mirror url>: HTTP 404 The mirror reaches them because Assertions.customizeExecutionContext and MavenSettingsAutoLoadingExtension load ~/.m2/settings.xml whenever the context has nothing configured. unresolvableMavenMetadata already pinned its parser context but left recipeExecutionContext a bare InMemoryExecutionContext, which is the one the metadata lookup uses. Both guards load settings only when nothing is configured, so pinning the repository opts out. That keeps these two running under a mirror rather than skipping them there, unlike the conditional disable openrewrite#7566 applied to the emptyRepositories tests, whose scenario a pinned repository would defeat.
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.
What's changed?
Re-enables two of the six tests disabled on 2026-05-04 after the Artifactory switch, by making their assertions independent of whatever mirror is configured rather than by skipping them.
AddDependencyTest.dontAddDuplicateIfUpdateModelOnPriorRecipeCycleFailedMavenDependencyFailuresTest.unresolvableMavenMetadataRoot cause
Both assert on a concrete repository URL, and a mirror rewrites it. Reproduced locally by pointing a wildcard
<mirrorOf>*</mirrorOf>atrepo1.maven.org(standing in for Artifactory) with the@Disabledremoved:The mirror reaches them because
Assertions.customizeExecutionContext(andMavenSettingsAutoLoadingExtension) load~/.m2/settings.xmlwhenever the context has nothing configured.unresolvableMavenMetadataalready pins its parser context, but leftrecipeExecutionContexta bareInMemoryExecutionContext, which is the one the metadata lookup uses.Approach
@DisabledIfEnvironmentVariabletreatment Provide Artifactory credentials to CI #7566 applied to theemptyRepositoriestests.Worth noting
Assertions.customizeExecutionContextships inrewrite-mavenmain, not test — so this sensitivity affects downstream users whose~/.m2/settings.xmlhas a mirror, not only this repo's CI.What it costs
The pinned context no longer honours a user's mirror for these two tests, which is the point but does mean they exercise a slightly narrower path than a default-context test. Both are failure-path tests asserting an exact message, so there is nothing a mirror would usefully add.
Tests
AddDependencyTest+MavenDependencyFailuresTest, run both ways:@Disabledremoved, unpinned)Final state: 59 tests, 0 failures, 0 errors, 1 skipped — identical with and without a mirror. The 1 skip is
unresolvableParent, left disabled (below).The other four
Deliberately untouched. I could not reproduce failures for
MavenDependencyFailuresTest.unresolvableParent,UpgradePluginVersionTest$PluginRepos.repoUnreachable, orUpgradePluginVersionTest$PluginRepos.noNewerVersion— but my stand-in mirror is not a faithful Artifactory: it does not proxy Red Hat GA or the Jenkins repo. The tell is that the currently-enabledUpgradePluginVersionTest$PluginRepos.updatefails under my stand-in because Central has no3.15.3.redhat-00002. All three of those tests depend on those same non-Central repositories, so "didn't reproduce here" is not evidence they'd pass against the real cache — someone who can run CI against Artifactory is better placed to settle them.rewrite-gradle'sUpgradeDependencyVersionTest.cannotDownloadMetaDataWhenNoRepositoriesAreDefined, has a different root cause and is handled separately in Gradle: disable the no-repositories metadata test only when a mirror is injected #8664.