Skip to content

Commit afbd177

Browse files
authored
Merge pull request #762 from jeysal/patch-1
download correct package for arch
2 parents ebee094 + 51cca3e commit afbd177

File tree

3 files changed

+108
-65
lines changed

3 files changed

+108
-65
lines changed

docs/guides/supported-systems.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Default version is none
144144
<span class="badge badge--danger">Unsupported</span> <span class="badge badge--secondary">Working</span>
145145

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

149149
:::note
150150
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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
203203
// Match "arch", "archlinux", "manjaro", "manjarolinux", "arco", "arcolinux"
204204
} else if (regexHelper(/(arch|manjaro|arco)(?:linux)?$/i, os)) {
205205
console.warn(
206-
`There is no official build of MongoDB for ArchLinux (${os.dist}). Falling back to Ubuntu 20.04 release.`
206+
`There is no official build of MongoDB for ArchLinux (${os.dist}). Falling back to Ubuntu 22.04 release.`
207207
);
208208

209209
return this.getUbuntuVersionString({
210210
os: 'linux',
211211
dist: 'Ubuntu Linux',
212-
release: '20.04',
212+
release: '22.04',
213213
});
214214
} else if (regexHelper(/gentoo/i, os)) {
215215
// it seems like debian binaries work for gentoo too (at least most), see https://github.com/nodkz/mongodb-memory-server/issues/639

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

Lines changed: 105 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,109 @@ describe('MongoBinaryDownloadUrl', () => {
637637
});
638638
});
639639

640+
// for arch and arch based systems (no specific extra mapping)
641+
describe('for arch', () => {
642+
it('for arch for 4.4.2', async () => {
643+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
644+
645+
const du = new MongoBinaryDownloadUrl({
646+
platform: 'linux',
647+
arch: 'x64',
648+
version: '4.4.2',
649+
os: {
650+
os: 'linux',
651+
dist: 'Arch',
652+
release: 'rolling',
653+
id_like: ['arch'],
654+
},
655+
});
656+
expect(await du.getDownloadUrl()).toBe(
657+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
658+
);
659+
expect(console.warn).toHaveBeenCalledTimes(1);
660+
});
661+
662+
it('for arch for 5.0.0', async () => {
663+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
664+
665+
const du = new MongoBinaryDownloadUrl({
666+
platform: 'linux',
667+
arch: 'x64',
668+
version: '5.0.0',
669+
os: {
670+
os: 'linux',
671+
dist: 'Arch',
672+
release: 'rolling',
673+
id_like: ['arch'],
674+
},
675+
});
676+
expect(await du.getDownloadUrl()).toBe(
677+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.0.tgz'
678+
);
679+
expect(console.warn).toHaveBeenCalledTimes(1);
680+
});
681+
682+
it('for arch for 6.0.4', async () => {
683+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
684+
685+
const du = new MongoBinaryDownloadUrl({
686+
platform: 'linux',
687+
arch: 'x64',
688+
version: '6.0.4',
689+
os: {
690+
os: 'linux',
691+
dist: 'Arch',
692+
release: 'rolling',
693+
id_like: ['arch'],
694+
},
695+
});
696+
expect(await du.getDownloadUrl()).toBe(
697+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-6.0.4.tgz'
698+
);
699+
expect(console.warn).toHaveBeenCalledTimes(1);
700+
});
701+
702+
it('for manjaro for 4.4.2', async () => {
703+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
704+
705+
const du = new MongoBinaryDownloadUrl({
706+
platform: 'linux',
707+
arch: 'x64',
708+
version: '4.4.2',
709+
os: {
710+
os: 'linux',
711+
dist: 'ManjaroLinux',
712+
release: '20.2',
713+
id_like: ['arch'],
714+
},
715+
});
716+
expect(await du.getDownloadUrl()).toBe(
717+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
718+
);
719+
expect(console.warn).toHaveBeenCalledTimes(1);
720+
});
721+
722+
it('for archstrike for 4.4.2', async () => {
723+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
724+
725+
const du = new MongoBinaryDownloadUrl({
726+
platform: 'linux',
727+
arch: 'x64',
728+
version: '4.4.2',
729+
os: {
730+
os: 'linux',
731+
dist: 'ArchStrike',
732+
release: 'rolling',
733+
id_like: ['arch'],
734+
},
735+
});
736+
expect(await du.getDownloadUrl()).toBe(
737+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
738+
);
739+
expect(console.warn).toHaveBeenCalledTimes(1);
740+
});
741+
});
742+
640743
it('fallback', async () => {
641744
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
642745

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

680-
it('for manjaro', async () => {
681-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
682-
683-
const du = new MongoBinaryDownloadUrl({
684-
platform: 'linux',
685-
arch: 'x64',
686-
version: '4.4.2',
687-
os: {
688-
os: 'linux',
689-
dist: 'ManjaroLinux',
690-
release: '20.2',
691-
id_like: ['arch'],
692-
},
693-
});
694-
expect(await du.getDownloadUrl()).toBe(
695-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
696-
);
697-
expect(console.warn).toHaveBeenCalledTimes(1);
698-
});
699-
700-
it('for arch', async () => {
701-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
702-
703-
const du = new MongoBinaryDownloadUrl({
704-
platform: 'linux',
705-
arch: 'x64',
706-
version: '4.4.2',
707-
os: {
708-
os: 'linux',
709-
dist: 'Arch',
710-
release: 'rolling',
711-
id_like: ['arch'],
712-
},
713-
});
714-
expect(await du.getDownloadUrl()).toBe(
715-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
716-
);
717-
expect(console.warn).toHaveBeenCalledTimes(1);
718-
});
719-
720783
describe('for gentoo', () => {
721784
it('for gentoo 5.0.8', async () => {
722785
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
@@ -757,26 +820,6 @@ describe('MongoBinaryDownloadUrl', () => {
757820
});
758821
});
759822

760-
it('for unpopular arch', async () => {
761-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
762-
763-
const du = new MongoBinaryDownloadUrl({
764-
platform: 'linux',
765-
arch: 'x64',
766-
version: '4.4.2',
767-
os: {
768-
os: 'linux',
769-
dist: 'ArchStrike',
770-
release: 'rolling',
771-
id_like: ['arch'],
772-
},
773-
});
774-
expect(await du.getDownloadUrl()).toBe(
775-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
776-
);
777-
expect(console.warn).toHaveBeenCalledTimes(1);
778-
});
779-
780823
describe('for elementary', () => {
781824
it('should return a archive name for elementary 0.3', async () => {
782825
const du = new MongoBinaryDownloadUrl({
@@ -1684,7 +1727,7 @@ describe('MongoBinaryDownloadUrl', () => {
16841727
});
16851728

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

1707-
it('should give an warning about "unknown"', () => {
1750+
it('should give a warning about "unknown"', () => {
17081751
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
17091752
const du = new MongoBinaryDownloadUrl({
17101753
platform: 'linux',

0 commit comments

Comments
 (0)