Skip to content

Commit 7bb5097

Browse files
committed
fix(MongoBinaryDownloadUrl): use debian92 for versions <4.2.0
fixes #448
1 parent 23374e3 commit 7bb5097

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,14 @@ export default class MongoBinaryDownloadUrl {
173173
let name = 'debian';
174174
const release: number = parseFloat(os.release);
175175
if (release >= 10 || ['unstable', 'testing'].includes(os.release)) {
176-
name += '10';
176+
if (semver.lte(this.version, '4.2.0')) {
177+
log(
178+
`getDebianVersionString: requested version "${this.version}" not available for osrelease "${release}", using "92"`
179+
);
180+
name += '92';
181+
} else {
182+
name += '10';
183+
}
177184
} else if (release >= 9) {
178185
name += '92';
179186
} else if (release >= 8.1) {

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('MongoBinaryDownloadUrl', () => {
6464
);
6565
});
6666

67-
it('for debian', async () => {
67+
it('for debian 81 for 3.6.3', async () => {
6868
const du = new MongoBinaryDownloadUrl({
6969
platform: 'linux',
7070
arch: 'x64',
@@ -80,6 +80,22 @@ describe('MongoBinaryDownloadUrl', () => {
8080
);
8181
});
8282

83+
it('for debian 10 for 4.0.20 should use debian 92 [#448]', async () => {
84+
const du = new MongoBinaryDownloadUrl({
85+
platform: 'linux',
86+
arch: 'x64',
87+
version: '4.0.20',
88+
os: {
89+
os: 'linux',
90+
dist: 'debian',
91+
release: '10',
92+
},
93+
});
94+
expect(await du.getDownloadUrl()).toBe(
95+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.20.tgz'
96+
);
97+
});
98+
8399
describe('for win32 & windows', () => {
84100
it('3.6 (win32)', async () => {
85101
const du = new MongoBinaryDownloadUrl({

0 commit comments

Comments
 (0)