Skip to content

Commit 1a88c37

Browse files
committed
feat(MongoBinaryDownloadUrl): support ubuntu 2404 & 8.0.0
instead of using 2204 binaries for 2404
1 parent 68d7a32 commit 1a88c37

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,21 +581,26 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
581581
return 'ubuntu2004';
582582
}
583583

584+
// there are only binaries for 2404 since 8.0.0, not in 7.x
585+
if (ubuntuYear >= 22 && semver.satisfies(coercedVersion, '<8.0.0')) {
586+
return 'ubuntu2204';
587+
}
588+
584589
// base case for higher than mongodb supported ubuntu versions
585590
{
586591
// TODO: try to keep this up-to-date to the latest mongodb supported ubuntu version
587592
/**
588593
* Highest ubuntu year supported by mongodb binaries
589594
* @see https://www.mongodb.com/download-center/community/releases/archive
590595
*/
591-
const highestUbuntuYear = 22; // 22 is the highest supported as of mongodb 7.0.11
596+
const highestUbuntuYear = 24; // 24 is the highest supported as of mongodb 8.0.1
592597

593598
if (ubuntuYear > highestUbuntuYear) {
594599
log(
595600
`getUbuntuVersionString: ubuntuYear "${ubuntuYear}" is higher than the currently supported mongodb year of "${highestUbuntuYear}", using highest known`
596601
);
597602

598-
return 'ubuntu2204';
603+
return 'ubuntu2404';
599604
}
600605
}
601606

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

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,70 @@ describe('MongoBinaryDownloadUrl', () => {
309309
);
310310
});
311311

312+
it('for ubuntu 22.04 for 7.0.11', async () => {
313+
const du = new MongoBinaryDownloadUrl({
314+
platform: 'linux',
315+
arch: 'x64',
316+
version: '7.0.11',
317+
os: {
318+
os: 'linux',
319+
dist: 'ubuntu',
320+
release: '22.04',
321+
},
322+
});
323+
expect(await du.getDownloadUrl()).toBe(
324+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.11.tgz'
325+
);
326+
});
327+
328+
it('for ubuntu 24.04 for 7.0.11', async () => {
329+
const du = new MongoBinaryDownloadUrl({
330+
platform: 'linux',
331+
arch: 'x64',
332+
version: '7.0.11',
333+
os: {
334+
os: 'linux',
335+
dist: 'ubuntu',
336+
release: '24.04',
337+
},
338+
});
339+
expect(await du.getDownloadUrl()).toBe(
340+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.11.tgz'
341+
);
342+
});
343+
344+
it('for ubuntu 22.04 for 8.0.1', async () => {
345+
const du = new MongoBinaryDownloadUrl({
346+
platform: 'linux',
347+
arch: 'x64',
348+
version: '8.0.1',
349+
os: {
350+
os: 'linux',
351+
dist: 'ubuntu',
352+
release: '22.04',
353+
},
354+
});
355+
expect(await du.getDownloadUrl()).toBe(
356+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-8.0.1.tgz'
357+
);
358+
});
359+
360+
it('for ubuntu 24.04 for 8.0.1', async () => {
361+
const du = new MongoBinaryDownloadUrl({
362+
platform: 'linux',
363+
arch: 'x64',
364+
version: '8.0.1',
365+
os: {
366+
os: 'linux',
367+
dist: 'ubuntu',
368+
release: '24.04',
369+
},
370+
});
371+
expect(await du.getDownloadUrl()).toBe(
372+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2404-8.0.1.tgz'
373+
);
374+
});
375+
312376
it('should allow v5.0-latest', async () => {
313377
const du = new MongoBinaryDownloadUrl({
314378
platform: 'linux',
@@ -352,15 +416,15 @@ describe('MongoBinaryDownloadUrl', () => {
352416
const du = new MongoBinaryDownloadUrl({
353417
platform: 'linux',
354418
arch: 'x64',
355-
version: '7.0.4', // highest released mongodb version
419+
version: '8.0.1', // highest released mongodb version
356420
os: {
357421
os: 'linux',
358422
dist: 'ubuntu',
359423
release: '24.04', // highest released ubuntu version
360424
},
361425
});
362426
expect(await du.getDownloadUrl()).toBe(
363-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.4.tgz'
427+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2404-8.0.1.tgz'
364428
);
365429
});
366430

0 commit comments

Comments
 (0)