Skip to content

Commit 48dbf43

Browse files
authored
fix(MongoBinaryDownloadUrl): support Debian 12 (Bookworm) (#858)
* fix(MongoBinaryDownloadUrl): support Debian 12 (Bookworm) MongoDB >=7.0.3 supports Debain 12. See https://jira.mongodb.org/browse/SERVER-77231 * docs(supported-systems): bump Debian version
1 parent b240cf6 commit 48dbf43

File tree

4 files changed

+81
-11
lines changed

4 files changed

+81
-11
lines changed

docs/guides/supported-systems.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ See [this mongodb issue](https://jira.mongodb.org/browse/SERVER-62300).
7171

7272
(uses mongodb's `debian` release)<br/>
7373
Lowest supported Distribution version is `71`<br/>
74-
Highest version is `11` (higher versions will be clamped to this value)<br/>
75-
Default version is `10` (when in `unstable` or `testing`, otherwise none)
74+
Highest version is `12` (higher versions will be clamped to this value)<br/>
75+
Default version is `12` (when in `unstable` or `testing`, otherwise none)
7676

7777
### Fedora
7878

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
286286
// see https://tracker.debian.org/news/1433360/accepted-base-files-13-source-into-unstable/
287287
const isTesting = ['unstable', 'testing', ''].includes(os.release);
288288

289-
if (isTesting || release >= 11) {
289+
if (isTesting || release >= 12) {
290+
name += '12';
291+
} else if (release >= 11) {
290292
// Debian 11 is compatible with the binaries for debian 10
291293
// but does not have binaries for before 5.0.8
292294
// and only set to use "debian10" if the requested version is not a latest version
@@ -306,7 +308,16 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
306308
name += '71';
307309
}
308310

309-
if (isTesting || release >= 10) {
311+
if (isTesting || release >= 12) {
312+
if (semver.lt(coercedVersion, '7.0.3') && !testVersionIsLatest(this.version)) {
313+
throw new KnownVersionIncompatibilityError(
314+
`Debian ${release || os.release || os.codename}`,
315+
this.version,
316+
'>=7.0.3',
317+
'Mongodb does not provide binaries for versions before 7.0.3 for Debian 12+ and also cannot be mapped to a previous Debian release'
318+
);
319+
}
320+
} else if (release >= 10) {
310321
if (semver.lt(coercedVersion, '4.2.1') && !testVersionIsLatest(this.version)) {
311322
throw new KnownVersionIncompatibilityError(
312323
`Debian ${release || os.release || os.codename}`,

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

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,22 @@ describe('MongoBinaryDownloadUrl', () => {
556556
);
557557
});
558558

559+
it('for debian 12 for 7.0.3', async () => {
560+
const du = new MongoBinaryDownloadUrl({
561+
platform: 'linux',
562+
arch: 'x64',
563+
version: '7.0.3',
564+
os: {
565+
os: 'linux',
566+
dist: 'debian',
567+
release: '12',
568+
},
569+
});
570+
expect(await du.getDownloadUrl()).toBe(
571+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian12-7.0.3.tgz'
572+
);
573+
});
574+
559575
it('should allow v5.0-latest', async () => {
560576
const du = new MongoBinaryDownloadUrl({
561577
platform: 'linux',
@@ -576,15 +592,15 @@ describe('MongoBinaryDownloadUrl', () => {
576592
const du = new MongoBinaryDownloadUrl({
577593
platform: 'linux',
578594
arch: 'x64',
579-
version: '5.0.9',
595+
version: '7.0.3',
580596
os: {
581597
os: 'linux',
582598
dist: 'debian',
583599
release: '',
584600
},
585601
});
586602
expect(await du.getDownloadUrl()).toBe(
587-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-5.0.9.tgz'
603+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian12-7.0.3.tgz'
588604
);
589605
});
590606

@@ -670,11 +686,49 @@ describe('MongoBinaryDownloadUrl', () => {
670686
}
671687
});
672688

673-
it('should throw a Error when requesting a version below 4.2.1 for debian testing [KnownVersionIncompatibilityError]', async () => {
689+
it('should throw an error when requesting a version below 7.0.3 for debian 12+ [#797] [KnownVersionIncompatibilityError]', async () => {
674690
const du = new MongoBinaryDownloadUrl({
675691
platform: 'linux',
676692
arch: 'x64',
677-
version: '4.0.25',
693+
version: '7.0.2',
694+
os: {
695+
os: 'linux',
696+
dist: 'debian',
697+
release: '12',
698+
},
699+
});
700+
701+
try {
702+
await du.getDownloadUrl();
703+
fail('Expected to throw a KnownVersionIncompatibilityError');
704+
} catch (err) {
705+
assertIsError(err);
706+
expect(err).toBeInstanceOf(KnownVersionIncompatibilityError);
707+
expect(err.message).toMatchSnapshot();
708+
}
709+
});
710+
711+
it('should not throw an error for v7.0-latest for debian 12', async () => {
712+
const du = new MongoBinaryDownloadUrl({
713+
platform: 'linux',
714+
arch: 'x64',
715+
version: 'v7.0-latest',
716+
os: {
717+
os: 'linux',
718+
dist: 'debian',
719+
release: '12',
720+
},
721+
});
722+
expect(await du.getDownloadUrl()).toBe(
723+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian12-v7.0-latest.tgz'
724+
);
725+
});
726+
727+
it('should throw a Error when requesting a version below 7.0.3 for debian testing [KnownVersionIncompatibilityError]', async () => {
728+
const du = new MongoBinaryDownloadUrl({
729+
platform: 'linux',
730+
arch: 'x64',
731+
version: '7.0.2',
678732
os: {
679733
os: 'linux',
680734
dist: 'debian',

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should thr
1010
Mongodb does not provide binaries for versions before 4.2.1 for Debian 10+ and also cannot be mapped to a previous Debian release"
1111
`;
1212

13-
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should throw a Error when requesting a version below 4.2.1 for debian testing [KnownVersionIncompatibilityError] 1`] = `
14-
"Requested Version \\"4.0.25\\" is not available for \\"Debian trixie\\"! Available Versions: \\">=4.2.1\\"
15-
Mongodb does not provide binaries for versions before 4.2.1 for Debian 10+ and also cannot be mapped to a previous Debian release"
13+
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should throw a Error when requesting a version below 7.0.3 for debian testing [KnownVersionIncompatibilityError] 1`] = `
14+
"Requested Version \\"7.0.2\\" is not available for \\"Debian trixie\\"! Available Versions: \\">=7.0.3\\"
15+
Mongodb does not provide binaries for versions before 7.0.3 for Debian 12+ and also cannot be mapped to a previous Debian release"
1616
`;
1717

1818
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should throw a Error when the provided version could not be coerced [UnknownVersionError] 1`] = `"Could not coerce VERSION to a semver version (version: \\"vvv\\")"`;
1919

20+
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should throw an error when requesting a version below 7.0.3 for debian 12+ [#797] [KnownVersionIncompatibilityError] 1`] = `
21+
"Requested Version \\"7.0.2\\" is not available for \\"Debian 12\\"! Available Versions: \\">=7.0.3\\"
22+
Mongodb does not provide binaries for versions before 7.0.3 for Debian 12+ and also cannot be mapped to a previous Debian release"
23+
`;
24+
2025
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for rhel should Error when ARM64 and rhel below 8 [KnownVersionIncompatibilityError] 1`] = `
2126
"Requested Version \\"4.4.2\\" is not available for \\"Rhel 7 arm64\\"! Available Versions: \\">=4.4.2\\"
2227
ARM64(aarch64) support for rhel is only for rhel82 or higher"

0 commit comments

Comments
 (0)