Skip to content

Commit

Permalink
fix(MongoBinaryDownloadUrl): fix rhel8 handling for newer versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Nov 1, 2024
1 parent 82b101a commit 48e99bf
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,21 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
if (semver.satisfies(releaseAsSemver, '>=9.0.0')) {
name += '90';
} else if (semver.satisfies(releaseAsSemver, '8.2.0') && this.arch == 'aarch64') {
name += '82';
// Mongodb changed its naming for rhel8 only https://jira.mongodb.org/browse/SERVER-92375
// NOTE: as of 10.10.2024 `(rhel8|rhel80)-7.0.13` is not downloadable but `7.0.14` is
if (semver.satisfies(coercedVersion, '^5.0.29 || ^6.0.17 || ^7.0.13 || ^8.0.0')) {
name += '8';
} else {
name += '82';
}
} else if (semver.satisfies(releaseAsSemver, '^8.0.0')) {
name += '80';
// Mongodb changed its naming for rhel8 only https://jira.mongodb.org/browse/SERVER-92375
// NOTE: as of 10.10.2024 `(rhel8|rhel80)-7.0.13` is not downloadable but `7.0.14` is
if (semver.satisfies(coercedVersion, '^5.0.29 || ^6.0.17 || ^7.0.13 || ^8.0.0')) {
name += '8';
} else {
name += '80';
}
} else if (semver.satisfies(releaseAsSemver, '^7.0.0')) {
name += '70';
} else if (semver.satisfies(releaseAsSemver, '^6.0.0')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,136 @@ describe('MongoBinaryDownloadUrl', () => {
);
});

describe('rhel 8 download name change (JIRA SERVER-92375)', () => {
it('rhel 8 & 5.0.29 x86_64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '5.0.29',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-5.0.29.tgz'
);
});

it('rhel 8 & 6.0.17 x86_64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '6.0.17',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-6.0.17.tgz'
);
});

it('rhel 8 & 7.0.13 x86_64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '7.0.13',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-7.0.13.tgz'
);
});

it('rhel 8 & 8.0.0 x86_64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '8.0.0',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-8.0.0.tgz'
);
});

it('rhel 8.2 & 5.0.29 arm64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'arm64',
version: '5.0.29',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-5.0.29.tgz'
);
});

it('rhel 8.2 & 6.0.17 arm64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'arm64',
version: '6.0.17',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-6.0.17.tgz'
);
});

it('rhel 8.2 & 7.0.13 arm64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'arm64',
version: '7.0.13',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-7.0.13.tgz'
);
});

it('rhel 8.2 & 8.0.0 arm64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'arm64',
version: '8.0.0',
os: {
os: 'linux',
dist: 'rhel',
release: '8.2',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-8.0.0.tgz'
);
});
});

it('rhel 8.2 & 4.4.2 arm64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
Expand Down

0 comments on commit 48e99bf

Please sign in to comment.