Skip to content

Commit

Permalink
fix(MongoBinaryDownloadUrl): refactor fedora handling to pass through…
Browse files Browse the repository at this point in the history
… to rhel

but set the mapping to rhel version first, like linux mint to ubuntu.

fixes #893
  • Loading branch information
hasezoey committed Oct 11, 2024
1 parent 7a1c0e6 commit 31b4696
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,25 +336,31 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
* @param os LinuxOS Object
*/
getFedoraVersionString(os: LinuxOS): string {
let name = 'rhel';
const fedoraVer: number = parseInt(os.release, 10);

const rhelOS: LinuxOS = {
os: 'linux',
dist: 'rhel',
// fallback to 8.0
release: '8.0',
};

// 36 and onwards dont ship with libcrypto.so.1.1 anymore and need to be manually installed ("openssl1.1")
// 34 onward dosnt have "compat-openssl10" anymore, and only build from 4.0.24 are available for "rhel80"
if (fedoraVer >= 34) {
name += '80';
rhelOS.release = '8.0';
}
if (fedoraVer < 34 && fedoraVer >= 19) {
name += '70';
rhelOS.release = '7.0';
}
if (fedoraVer < 19 && fedoraVer >= 12) {
name += '62';
rhelOS.release = '6.2';
}
if (fedoraVer < 12 && fedoraVer >= 6) {
name += '55';
rhelOS.release = '5.5';
}

return name;
return this.getRhelVersionString(rhelOS);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,22 @@ describe('MongoBinaryDownloadUrl', () => {
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.0.tgz'
);
});

it('fedora 36 & 7.0.13 x86_64', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '7.0.13',
os: {
os: 'linux',
dist: 'fedora',
release: '36',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel8-7.0.13.tgz'
);
});
});

// see https://github.com/typegoose/mongodb-memory-server/issues/527
Expand Down

0 comments on commit 31b4696

Please sign in to comment.