Skip to content

Commit

Permalink
Merge pull request #762 from jeysal/patch-1
Browse files Browse the repository at this point in the history
download correct package for arch
  • Loading branch information
hasezoey authored Apr 4, 2023
2 parents ebee094 + 51cca3e commit afbd177
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 65 deletions.
2 changes: 1 addition & 1 deletion docs/guides/supported-systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Default version is none
<span class="badge badge--danger">Unsupported</span> <span class="badge badge--secondary">Working</span>

There are no official mongodb builds for Arch Distributions, but the `ubuntu` binaries work on most Arch systems, so they are used.<br/>
Currently Mapping to: `ubuntu2004`
Currently Mapping to: `ubuntu2204`

:::note
Because Arch* dosnt base on ubuntu, there is no specific ubuntu version associated with an arch version, so it defaults to highest supported `ubuntu` version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
// Match "arch", "archlinux", "manjaro", "manjarolinux", "arco", "arcolinux"
} else if (regexHelper(/(arch|manjaro|arco)(?:linux)?$/i, os)) {
console.warn(
`There is no official build of MongoDB for ArchLinux (${os.dist}). Falling back to Ubuntu 20.04 release.`
`There is no official build of MongoDB for ArchLinux (${os.dist}). Falling back to Ubuntu 22.04 release.`
);

return this.getUbuntuVersionString({
os: 'linux',
dist: 'Ubuntu Linux',
release: '20.04',
release: '22.04',
});
} else if (regexHelper(/gentoo/i, os)) {
// it seems like debian binaries work for gentoo too (at least most), see https://github.com/nodkz/mongodb-memory-server/issues/639
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,109 @@ describe('MongoBinaryDownloadUrl', () => {
});
});

// for arch and arch based systems (no specific extra mapping)
describe('for arch', () => {
it('for arch for 4.4.2', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.2',
os: {
os: 'linux',
dist: 'Arch',
release: 'rolling',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

it('for arch for 5.0.0', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '5.0.0',
os: {
os: 'linux',
dist: 'Arch',
release: 'rolling',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.0.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

it('for arch for 6.0.4', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '6.0.4',
os: {
os: 'linux',
dist: 'Arch',
release: 'rolling',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.4.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

it('for manjaro for 4.4.2', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.2',
os: {
os: 'linux',
dist: 'ManjaroLinux',
release: '20.2',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

it('for archstrike for 4.4.2', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.2',
os: {
os: 'linux',
dist: 'ArchStrike',
release: 'rolling',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});
});

it('fallback', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

Expand Down Expand Up @@ -677,46 +780,6 @@ describe('MongoBinaryDownloadUrl', () => {
expect(console.warn).toHaveBeenCalledTimes(2);
});

it('for manjaro', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.2',
os: {
os: 'linux',
dist: 'ManjaroLinux',
release: '20.2',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

it('for arch', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.2',
os: {
os: 'linux',
dist: 'Arch',
release: 'rolling',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

describe('for gentoo', () => {
it('for gentoo 5.0.8', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
Expand Down Expand Up @@ -757,26 +820,6 @@ describe('MongoBinaryDownloadUrl', () => {
});
});

it('for unpopular arch', async () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);

const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.2',
os: {
os: 'linux',
dist: 'ArchStrike',
release: 'rolling',
id_like: ['arch'],
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
);
expect(console.warn).toHaveBeenCalledTimes(1);
});

describe('for elementary', () => {
it('should return a archive name for elementary 0.3', async () => {
const du = new MongoBinaryDownloadUrl({
Expand Down Expand Up @@ -1684,7 +1727,7 @@ describe('MongoBinaryDownloadUrl', () => {
});

describe('getLinuxOSVersionString()', () => {
it('should give an warning about "alpine"', () => {
it('should give a warning about "alpine"', () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
Expand All @@ -1704,7 +1747,7 @@ describe('MongoBinaryDownloadUrl', () => {
expect(ret).toBe('');
});

it('should give an warning about "unknown"', () => {
it('should give a warning about "unknown"', () => {
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
Expand Down

0 comments on commit afbd177

Please sign in to comment.