Skip to content

Commit ec1ea68

Browse files
authored
feat(MongoDownloadUrl): add support for amazon linux 2023 (#826)
* fix: add support for amazon linux 2023 The os string in the download url for amazon linux 2023 should be "amazon2023" * test: added test for Amazon 2023 download url
1 parent 3cdbed2 commit ec1ea68

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
430430
let name = 'amazon';
431431
const release: number = parseInt(os.release, 10);
432432

433-
if (release >= 2 && release <= 3) {
434-
name += '2';
433+
if (release >= 2) {
434+
name += release.toString();
435435
}
436436
// dont add anthing as fallback, because for "amazon 1", mongodb just uses "amazon"
437437

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,24 @@ describe('MongoBinaryDownloadUrl', () => {
10541054
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-4.0.24.tgz'
10551055
);
10561056
});
1057+
1058+
it('should return a archive name for Amazon 2023', async () => {
1059+
const du = new MongoBinaryDownloadUrl({
1060+
platform: 'linux',
1061+
arch: 'x64',
1062+
version: '7.0.2',
1063+
os: {
1064+
os: 'linux',
1065+
dist: 'amzn',
1066+
release: '2023',
1067+
id_like: ['fedora'],
1068+
},
1069+
});
1070+
1071+
expect(await du.getDownloadUrl()).toBe(
1072+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2023-7.0.2.tgz'
1073+
);
1074+
});
10571075
});
10581076

10591077
describe('for rhel', () => {

0 commit comments

Comments
 (0)