Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Bugfix: correctly parse current debian 9 two digit minor release #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions built/mongodb-download.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion built/mongodb-download.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/mongodb-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,13 @@ export class MongoDBPlatform {

getDebianVersionString(os: any): string {
let name: string = "debian";
let release: number = parseFloat(os.release);
if (release >= 9.2) {
let major_release: number = parseInt(os.release.split('.')[0]);
let minor_release: number = parseInt(os.release.split('.')[1]);
if (major_release >= 9 && minor_release >= 2) {
name += "92";
} else if (release >= 8.1) {
} else if ((major_release >= 8 && minor_release >= 1) || (major_release >= 9 && minor_release < 2)) {
name += "81";
} else if (release >= 7.1) {
} else if ((major_release >= 7 && minor_release >= 1) || (major_release >= 8 && minor_release < 1)) {
name += "71";
} else {
this.debug("using legacy release");
Expand Down
6 changes: 6 additions & 0 deletions test/MongoDBDownloadLocationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ const VARIATIONS = [
os: { dist: 'debian', release: '8.1' },
location: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-latest.tgz',
},
{
platform: 'linux',
version: 'latest',
os: { dist: 'debian', release: '9.11' },
location: 'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-latest.tgz',
},
];


Expand Down
6 changes: 6 additions & 0 deletions test/MongoDBPlatform-DebianTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@ describe('MongoDBPlatform class', () => {
expect(mongoDBDownload.getDebianVersionString(os)).to.equal("debian81");
done();
});

it('should return a archive name for debian 9.11', done => {
os.release = "9.11";
expect(mongoDBDownload.getDebianVersionString(os)).to.equal("debian92");
done();
});
})
});