File tree Expand file tree Collapse file tree 2 files changed +41
-12
lines changed
packages/mongodb-memory-server-core/src/util Expand file tree Collapse file tree 2 files changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,13 @@ export default class MongoBinaryDownloadUrl {
306306 const majorVer : number = parseInt ( ubuntuVer [ 0 ] , 10 ) ;
307307 // const minorVer: string = ubuntuVer[1];
308308
309+ // this is, because currently mongodb only really provides arm64 binaries for "ubuntu1604"
310+ if ( this . arch === 'arm64' ) {
311+ log ( 'getUbuntuVersionString: architecture "arm64" detected, using ubuntu1604' ) ;
312+
313+ return 'ubuntu1604' ;
314+ }
315+
309316 if ( os . release === '12.04' ) {
310317 name += '1204' ;
311318 } else if ( os . release === '14.04' ) {
@@ -366,17 +373,23 @@ export default class MongoBinaryDownloadUrl {
366373 * @param platform The Platform to translate
367374 */
368375 translateArch ( arch : string , mongoPlatform : string ) : string {
369- if ( arch === 'ia32' ) {
370- if ( mongoPlatform === 'linux' ) {
371- return 'i686' ;
372- } else if ( mongoPlatform === 'win32' ) {
373- return 'i386' ;
374- }
375- throw new Error ( 'unsupported architecture' ) ;
376- } else if ( arch === 'x64' ) {
377- return 'x86_64' ;
378- } else {
379- throw new Error ( 'unsupported architecture, ia32 and x64 are the only valid options' ) ;
376+ switch ( arch ) {
377+ case 'ia32' :
378+ if ( mongoPlatform === 'linux' ) {
379+ return 'i686' ;
380+ } else if ( mongoPlatform === 'win32' ) {
381+ return 'i386' ;
382+ }
383+
384+ throw new Error (
385+ `Unsupported Architecture-Platform combination: arch: "${ arch } ", platform: "${ mongoPlatform } "`
386+ ) ;
387+ case 'x64' :
388+ return 'x86_64' ;
389+ case 'arm64' :
390+ return 'arm64' ;
391+ default :
392+ throw new Error ( `Unsupported Architecture: arch: "${ arch } "` ) ;
380393 }
381394 }
382395}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ describe('MongoBinaryDownloadUrl', () => {
4848 } ) ;
4949 } ) ;
5050
51- it ( 'for ubuntu' , async ( ) => {
51+ it ( 'for ubuntu x64 ' , async ( ) => {
5252 const du = new MongoBinaryDownloadUrl ( {
5353 platform : 'linux' ,
5454 arch : 'x64' ,
@@ -64,6 +64,22 @@ describe('MongoBinaryDownloadUrl', () => {
6464 ) ;
6565 } ) ;
6666
67+ it ( 'for ubuntu arm64' , async ( ) => {
68+ const du = new MongoBinaryDownloadUrl ( {
69+ platform : 'linux' ,
70+ arch : 'arm64' ,
71+ version : '4.0.20' ,
72+ os : {
73+ os : 'linux' ,
74+ dist : 'Ubuntu Linux' ,
75+ release : '20.04' ,
76+ } ,
77+ } ) ;
78+ expect ( await du . getDownloadUrl ( ) ) . toBe (
79+ 'https://fastdl.mongodb.org/linux/mongodb-linux-arm64-ubuntu1604-4.0.20.tgz'
80+ ) ;
81+ } ) ;
82+
6783 it ( 'for debian 81 for 3.6.3' , async ( ) => {
6884 const du = new MongoBinaryDownloadUrl ( {
6985 platform : 'linux' ,
You can’t perform that action at this time.
0 commit comments