Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(maven): Refactor datasource tests #9745

Merged
merged 7 commits into from Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/datasource/maven/__snapshots__/index.spec.ts.snap
Expand Up @@ -339,7 +339,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://repo.maven.apache.org/maven2/org/example/package/maven-metadata.xml",
"url": "http://repo.maven.apache.org/maven2/org/example/package/maven-metadata.xml",
Copy link
Collaborator

Choose a reason for hiding this comment

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

??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Intentionally replaced https to http for this test. I needed to fix coverage and this test seemed pretty relevant for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Instead, probably it would be better to remove HTTP support at all

Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't removing HTTP support break support for internal maven repositories that aren't served via HTTPS?
Like sonatype nexus for example still comes out of the box with http as it's default port.
Other scenarios might see some old references to http:// where the server properly handles a 301 to https

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you're right

},
Object {
"headers": Object {
Expand All @@ -348,7 +348,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "HEAD",
"url": "https://repo.maven.apache.org/maven2/org/example/package/1.0.0/package-1.0.0.pom",
"url": "http://repo.maven.apache.org/maven2/org/example/package/1.0.0/package-1.0.0.pom",
},
Object {
"headers": Object {
Expand All @@ -357,7 +357,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "HEAD",
"url": "https://repo.maven.apache.org/maven2/org/example/package/1.0.1/package-1.0.1.pom",
"url": "http://repo.maven.apache.org/maven2/org/example/package/1.0.1/package-1.0.1.pom",
},
Object {
"headers": Object {
Expand All @@ -366,7 +366,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "HEAD",
"url": "https://repo.maven.apache.org/maven2/org/example/package/1.0.2/package-1.0.2.pom",
"url": "http://repo.maven.apache.org/maven2/org/example/package/1.0.2/package-1.0.2.pom",
},
Object {
"headers": Object {
Expand All @@ -375,7 +375,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "HEAD",
"url": "https://repo.maven.apache.org/maven2/org/example/package/2.0.0/package-2.0.0.pom",
"url": "http://repo.maven.apache.org/maven2/org/example/package/2.0.0/package-2.0.0.pom",
},
Object {
"headers": Object {
Expand All @@ -384,7 +384,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://repo.maven.apache.org/maven2/org/example/package/2.0.0/package-2.0.0.pom",
"url": "http://repo.maven.apache.org/maven2/org/example/package/2.0.0/package-2.0.0.pom",
},
]
`;
Expand Down
5 changes: 3 additions & 2 deletions lib/datasource/maven/index.spec.ts
Expand Up @@ -183,13 +183,14 @@ describe(getName(), () => {
});

it('ignores unsupported protocols', async () => {
mockGenericPackage();
const base = baseUrl.replace('https', 'http');
mockGenericPackage({ base });

const { releases } = await get(
'org.example:package',
'ftp://protocol_error_repo',
's3://protocol_error_repo',
baseUrl
base
);

expect(releases).toMatchSnapshot();
Expand Down