Skip to content

Commit 1ad603f

Browse files
committed
fix(MongoBinaryDownloadUrl): translate ubuntu 2104 to 2004
fixes #582
1 parent 2793375 commit 1ad603f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
422422
return 'ubuntu1804';
423423
}
424424

425+
// there are not binaries for ubuntu 21.04, so defaulting to one version below for now
426+
// see https://github.com/nodkz/mongodb-memory-server/issues/582
427+
if (ubuntuYear >= 21) {
428+
return 'ubuntu2004';
429+
}
430+
425431
// the "04" version always exists for ubuntu, use that as default
426432
return `ubuntu${ubuntuYear || 14}04`;
427433
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,17 @@ describe('MongoBinaryDownloadUrl', () => {
717717
).toBe('ubuntu1804');
718718
downloadUrl.version = oldMongoVersion;
719719
});
720+
721+
it('should return a archive name for Ubuntu 21.04 using 2004', () => {
722+
downloadUrl.version = '5.0.3';
723+
expect(
724+
downloadUrl.getUbuntuVersionString({
725+
os: 'linux',
726+
dist: 'Ubuntu Linux',
727+
release: '21.04',
728+
})
729+
).toBe('ubuntu2004');
730+
});
720731
});
721732

722733
describe('getDebianVersionString()', () => {

0 commit comments

Comments
 (0)