Skip to content

Commit 1d84dd8

Browse files
committed
test: add tests for mongodb 6.0.0
also adds more url tests for ubuntu
1 parent 4e662a9 commit 1d84dd8

File tree

3 files changed

+120
-1
lines changed

3 files changed

+120
-1
lines changed

packages/mongodb-memory-server-core/src/__tests__/testUtils/globalSetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { assertion, isNullOrUndefined } from '../../util/utils';
55
export = async function globalSetup(): Promise<void> {
66
const defaultVersion = resolveConfig(ResolveConfigVariables.VERSION);
77
assertion(!isNullOrUndefined(defaultVersion), new Error('Default version is not defined'));
8-
const versions = [defaultVersion, '4.0.28', '4.2.18', '4.4.13', '5.0.8'];
8+
const versions = [defaultVersion, '4.0.28', '4.2.18', '4.4.13', '5.0.8', '6.0.0'];
99
// Ensure all required versions are downloaded for tests
1010
for (const version of versions) {
1111
await MongoBinary.getPath({ version });

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

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ describe('MongoBinaryDownloadUrl', () => {
5959
);
6060
});
6161

62+
it('should work with mongodb 6.0', async () => {
63+
const du = new MongoBinaryDownloadUrl({
64+
platform: 'darwin',
65+
arch: 'x64',
66+
version: '6.0.0',
67+
});
68+
69+
expect(await du.getDownloadUrl()).toBe(
70+
'https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-6.0.0.tgz'
71+
);
72+
});
73+
6274
it('arm64 should use the x64 binary', async () => {
6375
const du = new MongoBinaryDownloadUrl({
6476
platform: 'darwin',
@@ -89,6 +101,70 @@ describe('MongoBinaryDownloadUrl', () => {
89101
);
90102
});
91103

104+
it('for ubuntu 20.04 for 5.0', async () => {
105+
const du = new MongoBinaryDownloadUrl({
106+
platform: 'linux',
107+
arch: 'x64',
108+
version: '5.0.8',
109+
os: {
110+
os: 'linux',
111+
dist: 'ubuntu',
112+
release: '2004',
113+
},
114+
});
115+
expect(await du.getDownloadUrl()).toBe(
116+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.8.tgz'
117+
);
118+
});
119+
120+
it('for ubuntu 22.04 for 5.0', async () => {
121+
const du = new MongoBinaryDownloadUrl({
122+
platform: 'linux',
123+
arch: 'x64',
124+
version: '5.0.8',
125+
os: {
126+
os: 'linux',
127+
dist: 'ubuntu',
128+
release: '2204',
129+
},
130+
});
131+
expect(await du.getDownloadUrl()).toBe(
132+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.8.tgz'
133+
);
134+
});
135+
136+
it('for ubuntu 20.04 for 6.0', async () => {
137+
const du = new MongoBinaryDownloadUrl({
138+
platform: 'linux',
139+
arch: 'x64',
140+
version: '6.0.0',
141+
os: {
142+
os: 'linux',
143+
dist: 'ubuntu',
144+
release: '2004',
145+
},
146+
});
147+
expect(await du.getDownloadUrl()).toBe(
148+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.0.tgz'
149+
);
150+
});
151+
152+
it('for ubuntu 22.04 for 6.0', async () => {
153+
const du = new MongoBinaryDownloadUrl({
154+
platform: 'linux',
155+
arch: 'x64',
156+
version: '6.0.0',
157+
os: {
158+
os: 'linux',
159+
dist: 'ubuntu',
160+
release: '2204',
161+
},
162+
});
163+
expect(await du.getDownloadUrl()).toBe(
164+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.0.tgz'
165+
);
166+
});
167+
92168
describe('arm64', () => {
93169
it('for ubuntu arm64 4.0.25 (below 4.1.10)', async () => {
94170
const du = new MongoBinaryDownloadUrl({
@@ -269,6 +345,22 @@ describe('MongoBinaryDownloadUrl', () => {
269345
);
270346
});
271347

348+
it('for debian 11 for 6.0.0', async () => {
349+
const du = new MongoBinaryDownloadUrl({
350+
platform: 'linux',
351+
arch: 'x64',
352+
version: '6.0.0',
353+
os: {
354+
os: 'linux',
355+
dist: 'debian',
356+
release: '11',
357+
},
358+
});
359+
expect(await du.getDownloadUrl()).toBe(
360+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-6.0.0.tgz'
361+
);
362+
});
363+
272364
it('should throw a Error when requesting a version below 4.2.1 for debian 10+ [#554] [KnownVersionIncompatibilityError]', async () => {
273365
const du = new MongoBinaryDownloadUrl({
274366
platform: 'linux',
@@ -612,6 +704,23 @@ describe('MongoBinaryDownloadUrl', () => {
612704
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-5.0.8.tgz'
613705
);
614706
});
707+
708+
it('should return a archive name for Fedora 36', async () => {
709+
const du = new MongoBinaryDownloadUrl({
710+
platform: 'linux',
711+
arch: 'x64',
712+
version: '6.0.0',
713+
os: {
714+
os: 'linux',
715+
dist: 'fedora',
716+
release: '36',
717+
},
718+
});
719+
720+
expect(await du.getDownloadUrl()).toBe(
721+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.0.tgz'
722+
);
723+
});
615724
});
616725

617726
// see https://github.com/nodkz/mongodb-memory-server/issues/527

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ describe('MongodbInstance', () => {
249249
expect(mongod.mongodProcess!.pid).toBeGreaterThan(0);
250250
await mongod.stop();
251251
});
252+
253+
it('should work with mongodb 6.0', async () => {
254+
const gotPort = await getPort({ port: 27445 });
255+
const mongod = await MongodbInstance.create({
256+
instance: { port: gotPort, dbPath: tmpDir.name },
257+
binary: { version: '6.0.0' },
258+
});
259+
expect(mongod.mongodProcess!.pid).toBeGreaterThan(0);
260+
await mongod.stop();
261+
});
252262
});
253263

254264
it('"kill" should not call "killProcess" if no childProcesses are not running', async () => {

0 commit comments

Comments
 (0)