Skip to content

Commit a978516

Browse files
committed
fix(DownloadUrl): for MongoDB v3 use 16.04 builds, cause distro for Ubuntu 18 has only v4 and above
Closes #100
1 parent b54ec6c commit a978516

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/util/MongoBinaryDownloadUrl.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export default class MongoBinaryDownloadUrl {
1717
os: ?getos.Os;
1818

1919
constructor({ platform, arch, version, os }: MongoBinaryDownloadUrlOpts) {
20+
this.version = version;
2021
this.platform = this.translatePlatform(platform);
2122
this.arch = this.translateArch(arch, this.platform);
22-
this.version = version;
2323
this.os = os;
2424
}
2525

@@ -201,7 +201,14 @@ export default class MongoBinaryDownloadUrl {
201201
} else if (majorVer === 16) {
202202
name += '1604';
203203
} else if (majorVer === 18) {
204-
name += '1804';
204+
if (this.version && this.version.indexOf('3.') === 0) {
205+
// For MongoDB 3.x using 1604 binaries, download distro does not have builds for Ubuntu 1804
206+
// https://www.mongodb.org/dl/linux/x86_64-ubuntu1604
207+
name += '1604';
208+
} else {
209+
// See fulllist of versions https://www.mongodb.org/dl/linux/x86_64-ubuntu1804
210+
name += '1804';
211+
}
205212
} else {
206213
name += '1404';
207214
}

src/util/__tests__/MongoBinaryDownloadUrl-test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,22 @@ describe('MongoBinaryDownloadUrl', () => {
118118
).toBe('ubuntu1204');
119119
});
120120
it('should return a archive name for Ubuntu 18.04', () => {
121+
const oldMongoVersion = downloadUrl.version;
122+
downloadUrl.version = '3.6.3';
123+
expect(
124+
downloadUrl.getUbuntuVersionString({
125+
dist: 'Ubuntu Linux',
126+
release: '18.04',
127+
})
128+
).toBe('ubuntu1604');
129+
downloadUrl.version = '4.0.1';
121130
expect(
122131
downloadUrl.getUbuntuVersionString({
123132
dist: 'Ubuntu Linux',
124133
release: '18.04',
125134
})
126135
).toBe('ubuntu1804');
136+
downloadUrl.version = oldMongoVersion;
127137
});
128138
});
129139

0 commit comments

Comments
 (0)