Skip to content

Commit 75fa22e

Browse files
committed
fix(MongoBinaryDownloadUrl): add support for Oracle Linux
fixes #746
1 parent 0059995 commit 75fa22e

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
191191
return this.getAmazonVersionString(os);
192192
} else if (regexHelper(/suse/i, os)) {
193193
return this.getSuseVersionString(os);
194-
} else if (regexHelper(/(rhel|centos|scientific)/i, os)) {
194+
// handle "oracle linux"(ol) as "rhel", because they define "id_like: fedora", but the versions themself match up with rhel
195+
} else if (regexHelper(/(rhel|centos|scientific|^ol$)/i, os)) {
195196
return this.getRhelVersionString(os);
196197
} else if (regexHelper(/fedora/i, os)) {
197198
return this.getFedoraVersionString(os);

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

+36
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,42 @@ describe('MongoBinaryDownloadUrl', () => {
12351235
}
12361236
});
12371237
});
1238+
1239+
describe('Oracle Linux', () => {
1240+
it('ol 8.7 & 5.0.0 x86_64', async () => {
1241+
const du = new MongoBinaryDownloadUrl({
1242+
platform: 'linux',
1243+
arch: 'x64',
1244+
version: '5.0.0',
1245+
os: {
1246+
os: 'linux',
1247+
dist: 'ol',
1248+
release: '8.7',
1249+
id_like: ['fedora'],
1250+
},
1251+
});
1252+
expect(await du.getDownloadUrl()).toBe(
1253+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-5.0.0.tgz'
1254+
);
1255+
});
1256+
1257+
it('ol 8.7 & 4.4.17 x86_64', async () => {
1258+
const du = new MongoBinaryDownloadUrl({
1259+
platform: 'linux',
1260+
arch: 'x64',
1261+
version: '4.4.17',
1262+
os: {
1263+
os: 'linux',
1264+
dist: 'ol',
1265+
release: '8.7',
1266+
id_like: ['fedora'],
1267+
},
1268+
});
1269+
expect(await du.getDownloadUrl()).toBe(
1270+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.17.tgz'
1271+
);
1272+
});
1273+
});
12381274
});
12391275

12401276
describe('for win32 & windows', () => {

0 commit comments

Comments
 (0)