Skip to content

Commit 79306c5

Browse files
committed
fix(MongoBinaryDownloadUrl): use debian92 for versions <4.2.0
fixes #448
1 parent c40e78d commit 79306c5

File tree

2 files changed

+39
-14
lines changed

2 files changed

+39
-14
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
@@ -201,7 +201,14 @@ export class MongoBinaryDownloadUrl {
201201
const release: number = parseFloat(os.release);
202202

203203
if (release >= 10 || ['unstable', 'testing'].includes(os.release)) {
204-
name += '10';
204+
if (semver.lte(this.version, '4.2.0')) {
205+
log(
206+
`getDebianVersionString: requested version "${this.version}" not available for osrelease "${release}", using "92"`
207+
);
208+
name += '92';
209+
} else {
210+
name += '10';
211+
}
205212
} else if (release >= 9) {
206213
name += '92';
207214
} else if (release >= 8.1) {

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

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,38 @@ describe('MongoBinaryDownloadUrl', () => {
9898
);
9999
});
100100

101-
it('for debian', async () => {
102-
const du = new MongoBinaryDownloadUrl({
103-
platform: 'linux',
104-
arch: 'x64',
105-
version: '3.6.3',
106-
os: {
107-
os: 'linux',
108-
dist: 'debian',
109-
release: '8.1',
110-
},
101+
describe('for debian', () => {
102+
it('for debian 81 for 3.6.3', async () => {
103+
const du = new MongoBinaryDownloadUrl({
104+
platform: 'linux',
105+
arch: 'x64',
106+
version: '3.6.3',
107+
os: {
108+
os: 'linux',
109+
dist: 'debian',
110+
release: '8.1',
111+
},
112+
});
113+
expect(await du.getDownloadUrl()).toBe(
114+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-3.6.3.tgz'
115+
);
116+
});
117+
118+
it('for debian 10 for 4.0.20 should use debian 92 [#448]', async () => {
119+
const du = new MongoBinaryDownloadUrl({
120+
platform: 'linux',
121+
arch: 'x64',
122+
version: '4.0.20',
123+
os: {
124+
os: 'linux',
125+
dist: 'debian',
126+
release: '10',
127+
},
128+
});
129+
expect(await du.getDownloadUrl()).toBe(
130+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.20.tgz'
131+
);
111132
});
112-
expect(await du.getDownloadUrl()).toBe(
113-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian81-3.6.3.tgz'
114-
);
115133
});
116134

117135
it('fallback', async () => {

0 commit comments

Comments
 (0)