Skip to content

Commit 6598792

Browse files
committed
fix(MongoBinaryDownloadUrl): support ubuntu 22.04 ^6.0.4
fixes #732
1 parent 4498e17 commit 6598792

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

docs/guides/supported-systems.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Architectures Supported: `x86_64`, `arm64`(`aarch64`)
6262
Lower Versions than `2004` may be used if mongodb dosnt provide binaries for an lower version of mongodb for an higher version of ubuntu
6363
:::
6464
:::note
65-
There are currently no native binaries for `2204`, so it is mapped to `2004` and will require `libssl1.1` to be installed.
65+
Since Mongodb `6.0.4` there are binaries for `2204`, any version before is mapped to `2204` (or earlier) and will require `libssl1.1` to be installed.
6666
See [this mongodb issue](https://jira.mongodb.org/browse/SERVER-62300).
6767
:::
6868

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,8 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
513513
return 'ubuntu1804';
514514
}
515515

516-
// there are not binaries for ubuntu 21.04, so defaulting to one version below for now
517-
// see https://github.com/nodkz/mongodb-memory-server/issues/582
518-
if (ubuntuYear >= 21) {
516+
// there are only binaries for 2204 since 6.0.4 (and not binaries for ubuntu2104)
517+
if (ubuntuYear >= 21 && semver.satisfies(coercedVersion, '<6.0.4')) {
519518
return 'ubuntu2004';
520519
}
521520

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

+20-4
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe('MongoBinaryDownloadUrl', () => {
176176
);
177177
});
178178

179-
it('for ubuntu 22.04 for 4.0', async () => {
179+
it('for ubuntu 22.04 for 4.0 (using 1804)', async () => {
180180
const du = new MongoBinaryDownloadUrl({
181181
platform: 'linux',
182182
arch: 'x64',
@@ -192,7 +192,7 @@ describe('MongoBinaryDownloadUrl', () => {
192192
);
193193
});
194194

195-
it('for ubuntu 22.04 for 4.4', async () => {
195+
it('for ubuntu 22.04 for 4.4 (using 2004)', async () => {
196196
const du = new MongoBinaryDownloadUrl({
197197
platform: 'linux',
198198
arch: 'x64',
@@ -224,7 +224,7 @@ describe('MongoBinaryDownloadUrl', () => {
224224
);
225225
});
226226

227-
it('for ubuntu 22.04 for 5.0', async () => {
227+
it('for ubuntu 22.04 for 5.0 (using 2004)', async () => {
228228
const du = new MongoBinaryDownloadUrl({
229229
platform: 'linux',
230230
arch: 'x64',
@@ -256,7 +256,7 @@ describe('MongoBinaryDownloadUrl', () => {
256256
);
257257
});
258258

259-
it('for ubuntu 22.04 for 6.0', async () => {
259+
it('for ubuntu 22.04 for 6.0 (using 2004)', async () => {
260260
const du = new MongoBinaryDownloadUrl({
261261
platform: 'linux',
262262
arch: 'x64',
@@ -272,6 +272,22 @@ describe('MongoBinaryDownloadUrl', () => {
272272
);
273273
});
274274

275+
it('for ubuntu 22.04 for 6.0.4', async () => {
276+
const du = new MongoBinaryDownloadUrl({
277+
platform: 'linux',
278+
arch: 'x64',
279+
version: '6.0.4',
280+
os: {
281+
os: 'linux',
282+
dist: 'ubuntu',
283+
release: '22.04',
284+
},
285+
});
286+
expect(await du.getDownloadUrl()).toBe(
287+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.4.tgz'
288+
);
289+
});
290+
275291
it('should allow v5.0-latest', async () => {
276292
const du = new MongoBinaryDownloadUrl({
277293
platform: 'linux',

0 commit comments

Comments
 (0)