Skip to content

Commit

Permalink
fix(MongoBinaryDownloadUrl): use debian92 for versions <4.2.0
Browse files Browse the repository at this point in the history
fixes #448
  • Loading branch information
hasezoey committed Mar 8, 2021
1 parent c40e78d commit 79306c5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,14 @@ export class MongoBinaryDownloadUrl {
const release: number = parseFloat(os.release);

if (release >= 10 || ['unstable', 'testing'].includes(os.release)) {
name += '10';
if (semver.lte(this.version, '4.2.0')) {
log(
`getDebianVersionString: requested version "${this.version}" not available for osrelease "${release}", using "92"`
);
name += '92';
} else {
name += '10';
}
} else if (release >= 9) {
name += '92';
} else if (release >= 8.1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,38 @@ describe('MongoBinaryDownloadUrl', () => {
);
});

it('for debian', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '3.6.3',
os: {
os: 'linux',
dist: 'debian',
release: '8.1',
},
describe('for debian', () => {
it('for debian 81 for 3.6.3', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '3.6.3',
os: {
os: 'linux',
dist: 'debian',
release: '8.1',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-3.6.3.tgz'
);
});

it('for debian 10 for 4.0.20 should use debian 92 [#448]', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.0.20',
os: {
os: 'linux',
dist: 'debian',
release: '10',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.20.tgz'
);
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-3.6.3.tgz'
);
});

it('fallback', async () => {
Expand Down

0 comments on commit 79306c5

Please sign in to comment.