-
-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compose Metadata Analyzer: Use v2 URL
Signed-off-by: Valentijn Scholten <[email protected]>
- Loading branch information
1 parent
45982a2
commit 22b55f7
Showing
4 changed files
with
44 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ public void testAnalyzerFindsVersionWithLeadingV() throws Exception { | |
.when( | ||
request() | ||
.withMethod("GET") | ||
.withPath("/p/typo3/class-alias-loader.json") | ||
.withPath("/p2/typo3/class-alias-loader.json") | ||
) | ||
.respond( | ||
response() | ||
|
@@ -96,6 +96,14 @@ public void testAnalyzerFindsVersionWithLeadingV() throws Exception { | |
); | ||
} | ||
|
||
/* | ||
* This case no longer happens in the composer v2 repositories. It now returns a 404 for all examples from #2134 | ||
* - adobe-ims.json | ||
* - adobe-stock-integration.json | ||
* - composter-root-update-plugin.json | ||
* - module-aws-s3.json | ||
* Leaving it here in case we find a different package triggering this behaviour. | ||
@Test | ||
public void testAnalyzerGetsUnexpectedResponseContentCausingLatestVersionBeingNull() throws Exception { | ||
Component component = new Component(); | ||
|
@@ -109,7 +117,7 @@ public void testAnalyzerGetsUnexpectedResponseContentCausingLatestVersionBeingNu | |
.when( | ||
request() | ||
.withMethod("GET") | ||
.withPath("/p/magento/adobe-ims.json") | ||
.withPath("/p2/magento/adobe-ims.json") | ||
) | ||
.respond( | ||
response() | ||
|
@@ -123,12 +131,41 @@ public void testAnalyzerGetsUnexpectedResponseContentCausingLatestVersionBeingNu | |
Assert.assertNull(metaModel.getLatestVersion()); | ||
} | ||
*/ | ||
|
||
@Test | ||
public void testAnalyzerGetsUnexpectedResponseContent404() throws Exception { | ||
Component component = new Component(); | ||
ComposerMetaAnalyzer analyzer = new ComposerMetaAnalyzer(); | ||
|
||
component.setPurl(new PackageURL("pkg:composer/magento/[email protected]")); | ||
final File packagistFile = getResourceFile("magento", "adobe-ims"); | ||
|
||
analyzer.setRepositoryBaseUrl(String.format("http://localhost:%d", mockServer.getPort())); | ||
new MockServerClient("localhost", mockServer.getPort()) | ||
.when( | ||
request() | ||
.withMethod("GET") | ||
.withPath("/p2/magento/adobe-ims.json") | ||
) | ||
.respond( | ||
response() | ||
.withStatusCode(404) | ||
.withHeader(HttpHeaders.CONTENT_TYPE, "application/json") | ||
); | ||
|
||
analyzer.analyze(component); | ||
MetaModel metaModel = analyzer.analyze(component); | ||
|
||
Assert.assertNull(metaModel.getLatestVersion()); | ||
} | ||
|
||
|
||
private static File getResourceFile(String namespace, String name) throws Exception{ | ||
return new File( | ||
Thread.currentThread().getContextClassLoader() | ||
.getResource(String.format( | ||
"unit/tasks/repositories/https---repo.packagist.org-p-%s-%s.json", | ||
"unit/tasks/repositories/https---repo.packagist.org-p2-%s-%s.json", | ||
namespace, | ||
name | ||
)) | ||
|
1 change: 0 additions & 1 deletion
1
...est/resources/unit/tasks/repositories/https---repo.packagist.org-p-magento-adobe-ims.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.