Skip to content

Commit 8c20624

Browse files
committed
fix(MongoBinaryDownloadUrl): fix rhel8 handling for newer versions
fixes #893 https://jira.mongodb.org/browse/SERVER-92375
1 parent 1225419 commit 8c20624

File tree

2 files changed

+144
-2
lines changed

2 files changed

+144
-2
lines changed

packages/mongodb-memory-server-core/src/util/MongoBinaryDownloadUrl.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,21 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
408408
if (semver.satisfies(releaseAsSemver, '>=9.0.0')) {
409409
name += '90';
410410
} else if (semver.satisfies(releaseAsSemver, '8.2.0') && this.arch == 'aarch64') {
411-
name += '82';
411+
// Mongodb changed its naming for rhel8 only https://jira.mongodb.org/browse/SERVER-92375
412+
// NOTE: as of 10.10.2024 `(rhel8|rhel80)-7.0.13` is not downloadable but `7.0.14` is
413+
if (semver.satisfies(coercedVersion, '^5.0.29 || ^6.0.17 || ^7.0.13 || ^8.0.0')) {
414+
name += '8';
415+
} else {
416+
name += '82';
417+
}
412418
} else if (semver.satisfies(releaseAsSemver, '^8.0.0')) {
413-
name += '80';
419+
// Mongodb changed its naming for rhel8 only https://jira.mongodb.org/browse/SERVER-92375
420+
// NOTE: as of 10.10.2024 `(rhel8|rhel80)-7.0.13` is not downloadable but `7.0.14` is
421+
if (semver.satisfies(coercedVersion, '^5.0.29 || ^6.0.17 || ^7.0.13 || ^8.0.0')) {
422+
name += '8';
423+
} else {
424+
name += '80';
425+
}
414426
} else if (semver.satisfies(releaseAsSemver, '^7.0.0')) {
415427
name += '70';
416428
} else if (semver.satisfies(releaseAsSemver, '^6.0.0')) {

packages/mongodb-memory-server-core/src/util/__tests__/MongoBinaryDownloadUrl.test.ts

+130
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,136 @@ describe('MongoBinaryDownloadUrl', () => {
13481348
);
13491349
});
13501350

1351+
describe('rhel 8 download name change (JIRA SERVER-92375)', () => {
1352+
it('rhel 8 & 5.0.29 x86_64', async () => {
1353+
const du = new MongoBinaryDownloadUrl({
1354+
platform: 'linux',
1355+
arch: 'x64',
1356+
version: '5.0.29',
1357+
os: {
1358+
os: 'linux',
1359+
dist: 'rhel',
1360+
release: '8.2',
1361+
},
1362+
});
1363+
expect(await du.getDownloadUrl()).toBe(
1364+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-5.0.29.tgz'
1365+
);
1366+
});
1367+
1368+
it('rhel 8 & 6.0.17 x86_64', async () => {
1369+
const du = new MongoBinaryDownloadUrl({
1370+
platform: 'linux',
1371+
arch: 'x64',
1372+
version: '6.0.17',
1373+
os: {
1374+
os: 'linux',
1375+
dist: 'rhel',
1376+
release: '8.2',
1377+
},
1378+
});
1379+
expect(await du.getDownloadUrl()).toBe(
1380+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-6.0.17.tgz'
1381+
);
1382+
});
1383+
1384+
it('rhel 8 & 7.0.13 x86_64', async () => {
1385+
const du = new MongoBinaryDownloadUrl({
1386+
platform: 'linux',
1387+
arch: 'x64',
1388+
version: '7.0.13',
1389+
os: {
1390+
os: 'linux',
1391+
dist: 'rhel',
1392+
release: '8.2',
1393+
},
1394+
});
1395+
expect(await du.getDownloadUrl()).toBe(
1396+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-7.0.13.tgz'
1397+
);
1398+
});
1399+
1400+
it('rhel 8 & 8.0.0 x86_64', async () => {
1401+
const du = new MongoBinaryDownloadUrl({
1402+
platform: 'linux',
1403+
arch: 'x64',
1404+
version: '8.0.0',
1405+
os: {
1406+
os: 'linux',
1407+
dist: 'rhel',
1408+
release: '8.2',
1409+
},
1410+
});
1411+
expect(await du.getDownloadUrl()).toBe(
1412+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-8.0.0.tgz'
1413+
);
1414+
});
1415+
1416+
it('rhel 8.2 & 5.0.29 arm64', async () => {
1417+
const du = new MongoBinaryDownloadUrl({
1418+
platform: 'linux',
1419+
arch: 'arm64',
1420+
version: '5.0.29',
1421+
os: {
1422+
os: 'linux',
1423+
dist: 'rhel',
1424+
release: '8.2',
1425+
},
1426+
});
1427+
expect(await du.getDownloadUrl()).toBe(
1428+
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-5.0.29.tgz'
1429+
);
1430+
});
1431+
1432+
it('rhel 8.2 & 6.0.17 arm64', async () => {
1433+
const du = new MongoBinaryDownloadUrl({
1434+
platform: 'linux',
1435+
arch: 'arm64',
1436+
version: '6.0.17',
1437+
os: {
1438+
os: 'linux',
1439+
dist: 'rhel',
1440+
release: '8.2',
1441+
},
1442+
});
1443+
expect(await du.getDownloadUrl()).toBe(
1444+
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-6.0.17.tgz'
1445+
);
1446+
});
1447+
1448+
it('rhel 8.2 & 7.0.13 arm64', async () => {
1449+
const du = new MongoBinaryDownloadUrl({
1450+
platform: 'linux',
1451+
arch: 'arm64',
1452+
version: '7.0.13',
1453+
os: {
1454+
os: 'linux',
1455+
dist: 'rhel',
1456+
release: '8.2',
1457+
},
1458+
});
1459+
expect(await du.getDownloadUrl()).toBe(
1460+
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-7.0.13.tgz'
1461+
);
1462+
});
1463+
1464+
it('rhel 8.2 & 8.0.0 arm64', async () => {
1465+
const du = new MongoBinaryDownloadUrl({
1466+
platform: 'linux',
1467+
arch: 'arm64',
1468+
version: '8.0.0',
1469+
os: {
1470+
os: 'linux',
1471+
dist: 'rhel',
1472+
release: '8.2',
1473+
},
1474+
});
1475+
expect(await du.getDownloadUrl()).toBe(
1476+
'https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel8-8.0.0.tgz'
1477+
);
1478+
});
1479+
});
1480+
13511481
it('rhel 8.2 & 4.4.2 arm64', async () => {
13521482
const du = new MongoBinaryDownloadUrl({
13531483
platform: 'linux',

0 commit comments

Comments
 (0)