Skip to content

Commit

Permalink
feat(MongoBinaryDownloadUrl): support ubuntu 2404 & 8.0.0
Browse files Browse the repository at this point in the history
instead of using 2204 binaries for 2404
  • Loading branch information
hasezoey committed Oct 9, 2024
1 parent 68d7a32 commit 1a88c37
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -581,21 +581,26 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
return 'ubuntu2004';
}

// there are only binaries for 2404 since 8.0.0, not in 7.x
if (ubuntuYear >= 22 && semver.satisfies(coercedVersion, '<8.0.0')) {
return 'ubuntu2204';
}

// base case for higher than mongodb supported ubuntu versions
{
// TODO: try to keep this up-to-date to the latest mongodb supported ubuntu version
/**
* Highest ubuntu year supported by mongodb binaries
* @see https://www.mongodb.com/download-center/community/releases/archive
*/
const highestUbuntuYear = 22; // 22 is the highest supported as of mongodb 7.0.11
const highestUbuntuYear = 24; // 24 is the highest supported as of mongodb 8.0.1

if (ubuntuYear > highestUbuntuYear) {
log(
`getUbuntuVersionString: ubuntuYear "${ubuntuYear}" is higher than the currently supported mongodb year of "${highestUbuntuYear}", using highest known`
);

return 'ubuntu2204';
return 'ubuntu2404';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,70 @@ describe('MongoBinaryDownloadUrl', () => {
);
});

it('for ubuntu 22.04 for 7.0.11', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '7.0.11',
os: {
os: 'linux',
dist: 'ubuntu',
release: '22.04',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.11.tgz'
);
});

it('for ubuntu 24.04 for 7.0.11', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '7.0.11',
os: {
os: 'linux',
dist: 'ubuntu',
release: '24.04',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.11.tgz'
);
});

it('for ubuntu 22.04 for 8.0.1', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '8.0.1',
os: {
os: 'linux',
dist: 'ubuntu',
release: '22.04',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-8.0.1.tgz'
);
});

it('for ubuntu 24.04 for 8.0.1', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '8.0.1',
os: {
os: 'linux',
dist: 'ubuntu',
release: '24.04',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2404-8.0.1.tgz'
);
});

it('should allow v5.0-latest', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
Expand Down Expand Up @@ -352,15 +416,15 @@ describe('MongoBinaryDownloadUrl', () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '7.0.4', // highest released mongodb version
version: '8.0.1', // highest released mongodb version
os: {
os: 'linux',
dist: 'ubuntu',
release: '24.04', // highest released ubuntu version
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.4.tgz'
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2404-8.0.1.tgz'
);
});

Expand Down

0 comments on commit 1a88c37

Please sign in to comment.