You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Debian 11 is compatible with the binaries for debian 10
249
256
// but does not have binaries for before 5.0.8
250
-
if(semver.lt(this.version,'5.0.8')){
257
+
if(semver.lt(coercedVersion,'5.0.8')){
251
258
log('debian11 detected, but version below 5.0.8 requested, using debian10');
252
259
name+='10';
253
260
}else{
@@ -264,7 +271,7 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
264
271
}
265
272
266
273
if(release>=10){
267
-
if(semver.lt(this.version,'4.2.1')){
274
+
if(semver.lt(coercedVersion,'4.2.1')){
268
275
thrownewKnownVersionIncompatibilityError(
269
276
`Debian ${release}`,
270
277
this.version,
@@ -311,6 +318,11 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
311
318
letname='rhel';
312
319
const{ release }=os;
313
320
constreleaseAsSemver=semver.coerce(release);// coerce "8" to "8.0.0" and "8.2" to "8.2.0", makes comparing easier than "parseInt" or "parseFloat"
321
+
constcoercedVersion=semver.coerce(this.version);
322
+
323
+
if(isNullOrUndefined(coercedVersion)){
324
+
thrownewUnknownVersionError(this.version);
325
+
}
314
326
315
327
if(releaseAsSemver){
316
328
if(this.arch==='aarch64'){
@@ -325,7 +337,7 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
325
337
}
326
338
// there are no versions for aarch64 before mongodb 4.4.2
327
339
// Note: version 4.4.2 and 4.4.3 are NOT listed at the list, but are existing; list: https://www.mongodb.com/download-center/community/releases/archive
Copy file name to clipboardExpand all lines: packages/mongodb-memory-server-core/src/util/__tests__/__snapshots__/MongoBinaryDownloadUrl.test.ts.snap
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should thr
10
10
Mongodb does not provide binaries for versions before 4.2.1 for Debian 10+ and also cannot be mapped to a previous Debian release"
11
11
`;
12
12
13
+
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for debian should throw a Error when the provided version could not be coerced [UnknownVersionError] 1`] =`"Could not corece VERSION to a semver version (version: \\"vvv\\")"`;
14
+
13
15
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for rhel should Error when ARM64 and rhel below 8 [KnownVersionIncompatibilityError] 1`] =`
14
16
"Requested Version \\"4.4.2\\" is not available for \\"Rhel 7\\"! Available Versions: \\">=4.4.2\\"
15
17
ARM64(aarch64) support for rhel is only for rhel82 or higher"
@@ -20,6 +22,10 @@ exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for rhel should Error
20
22
ARM64(aarch64) support for rhel is only for rhel82 or higher"
21
23
`;
22
24
25
+
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for rhel should throw a Error when the provided version could not be coerced [UnknownVersionError] 1`] =`"Could not corece VERSION to a semver version (version: \\"vvv\\")"`;
26
+
27
+
exports[`MongoBinaryDownloadUrl getDownloadUrl() for linux for ubuntu should throw a Error when the provided version could not be coerced [UnknownVersionError] 1`] =`"Could not corece VERSION to a semver version (version: \\"vvv\\")"`;
28
+
23
29
exports[`MongoBinaryDownloadUrl getDownloadUrl() should throw an error if platform is unknown (getArchiveName) 1`] =`"Unknown Platform: \\"unknown\\""`;
24
30
25
31
exports[`MongoBinaryDownloadUrl getDownloadUrl() should throw an error if platform is unknown (translatePlatform) 1`] =`"Unknown Platform: \\"unknown\\""`;
0 commit comments