Skip to content

Commit ffe2875

Browse files
committed
fix: change default version to "4.0.25"
1 parent 3429e69 commit ffe2875

File tree

9 files changed

+34
-34
lines changed

9 files changed

+34
-34
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ And one of those:
8989

9090
### Configuring which mongod binary to use
9191

92-
The default behaviour is that version ~~`latest`~~`4.0.20` for your OS will be downloaded. By setting [Environment variables](https://nodkz.github.io/mongodb-memory-server/docs/api/config-options) you are able to specify which version and binary will be downloaded:
92+
The default behaviour is that version ~~`latest`~~`4.0.25` for your OS will be downloaded. By setting [Environment variables](https://nodkz.github.io/mongodb-memory-server/docs/api/config-options) you are able to specify which version and binary will be downloaded:
9393

9494
```sh
9595
export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.8.tgz
@@ -143,7 +143,7 @@ const mongod = new MongoMemoryServer({
143143
args?: string[], // by default no additional arguments, any additional command line arguments for `mongod` `mongod` (ex. ['--notablescan'])
144144
},
145145
binary: {
146-
version?: string, // by default '4.0.20'
146+
version?: string, // by default '4.0.25'
147147
downloadDir?: string, // by default node_modules/.cache/mongodb-memory-server/mongodb-binaries
148148
platform?: string, // by default os.platform()
149149
arch?: string, // by default os.arch()

docs/api/config-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Valid Options are `ia32`, `x64`, `arm64`
3939

4040
Option `VERSION` is used to set what mongodb version should be downloaded
4141

42-
Default: `4.0.20`
42+
Default: `4.0.25`
4343

4444
### DEBUG
4545

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class DryMongoBinary {
9797
static async generateOptions(
9898
opts?: DryMongoBinaryOptions
9999
): Promise<Required<DryMongoBinaryOptions>> {
100-
const defaultVersion = resolveConfig(ResolveConfigVariables.VERSION) ?? '4.0.20';
100+
const defaultVersion = resolveConfig(ResolveConfigVariables.VERSION) ?? '4.0.25';
101101
const ensuredOpts: DryMongoBinaryOptions = isNullOrUndefined(opts)
102102
? { version: defaultVersion }
103103
: opts;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class MongoBinary {
9393
log(`getPath: Spawning binaryPath "${binaryPath}" to get version`);
9494
const spawnOutput = spawnSync(binaryPath, ['--version'])
9595
.stdout.toString()
96-
// this regex is to match the first line of the "mongod --version" output "db version v4.0.20"
96+
// this regex is to match the first line of the "mongod --version" output "db version v4.0.25"
9797
.match(/^\s*db\s+version\s+v?(\d+\.\d+\.\d+)\s*$/im);
9898

9999
assertion(

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ describe('MongoBinary', () => {
112112
});
113113

114114
it('should return and check an SystemBinary', async () => {
115-
// Output taken from mongodb x64 for "ubuntu" version "4.0.20"
115+
// Output taken from mongodb x64 for "ubuntu" version "4.0.25"
116116
// DO NOT INDENT THE TEXT
117117
jest.spyOn(childProcess, 'spawnSync').mockReturnValue(
118118
// @ts-expect-error Because "Buffer" is missing values from type, but they are not used in code, so its fine
119119
{
120-
stdout: Buffer.from(`db version v4.0.20
120+
stdout: Buffer.from(`db version v4.0.25
121121
git version: e2416422da84a0b63cde2397d60b521758b56d1b
122122
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
123123
allocator: tcmalloc
@@ -128,7 +128,7 @@ build environment:
128128
target_arch: x86_64`),
129129
}
130130
);
131-
process.env[envName(ResolveConfigVariables.VERSION)] = '4.0.20'; // set it explicitly to that version to test matching versions
131+
process.env[envName(ResolveConfigVariables.VERSION)] = '4.0.25'; // set it explicitly to that version to test matching versions
132132
process.env[envName(ResolveConfigVariables.SYSTEM_BINARY)] = sysBinaryPath;
133133

134134
const output = await MongoBinary.getPath();
@@ -139,12 +139,12 @@ build environment:
139139

140140
it('should return and check an SystemBinary and warn version conflict', async () => {
141141
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
142-
// Output taken from mongodb x64 for "ubuntu" version "4.0.20"
142+
// Output taken from mongodb x64 for "ubuntu" version "4.0.25"
143143
// DO NOT INDENT THE TEXT
144144
jest.spyOn(childProcess, 'spawnSync').mockReturnValue(
145145
// @ts-expect-error Because "Buffer" is missing values from type, but they are not used in code, so its fine
146146
{
147-
stdout: Buffer.from(`db version v4.0.20
147+
stdout: Buffer.from(`db version v4.0.25
148148
git version: e2416422da84a0b63cde2397d60b521758b56d1b
149149
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
150150
allocator: tcmalloc

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('MongoBinaryDownload', () => {
161161
const downloadDir = '/path/to/downloadDir';
162162
jest.spyOn(DryMongoBinary, 'generateOptions').mockResolvedValue({
163163
arch: 'x64',
164-
version: '4.0.20',
164+
version: '4.0.25',
165165
downloadDir: downloadDir,
166166
systemBinary: '',
167167
os: {
@@ -175,11 +175,11 @@ describe('MongoBinaryDownload', () => {
175175

176176
// @ts-expect-error because "getPath" is "protected"
177177
const path = await du.getPath();
178-
expect(path).toEqual(`${downloadDir}/mongod-x64-ubuntu-4.0.20`);
178+
expect(path).toEqual(`${downloadDir}/mongod-x64-ubuntu-4.0.25`);
179179
});
180180

181181
it('should print the download progress (printDownloadProgress)', () => {
182-
const version = '4.0.20';
182+
const version = '4.0.25';
183183
process.stdout.isTTY = false;
184184
jest.spyOn(console, 'log').mockImplementation(() => void 0);
185185
jest.spyOn(process.stdout, 'write').mockImplementation(() => true);

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ describe('MongoBinaryDownloadUrl', () => {
8585
});
8686

8787
describe('arm64', () => {
88-
it('for ubuntu arm64 4.0.20 (below 4.1.10)', async () => {
88+
it('for ubuntu arm64 4.0.25 (below 4.1.10)', async () => {
8989
const du = new MongoBinaryDownloadUrl({
9090
platform: 'linux',
9191
arch: 'arm64',
92-
version: '4.0.20',
92+
version: '4.0.25',
9393
os: {
9494
os: 'linux',
9595
dist: 'Ubuntu Linux',
9696
release: '20.04',
9797
},
9898
});
9999
expect(await du.getDownloadUrl()).toBe(
100-
'https://fastdl.mongodb.org/linux/mongodb-linux-arm64-ubuntu1604-4.0.20.tgz'
100+
'https://fastdl.mongodb.org/linux/mongodb-linux-arm64-ubuntu1604-4.0.25.tgz'
101101
);
102102
});
103103

@@ -168,19 +168,19 @@ describe('MongoBinaryDownloadUrl', () => {
168168
);
169169
});
170170

171-
it('for debian 10 for 4.0.20 should use debian 92 [#448]', async () => {
171+
it('for debian 10 for 4.0.25 should use debian 92 [#448]', async () => {
172172
const du = new MongoBinaryDownloadUrl({
173173
platform: 'linux',
174174
arch: 'x64',
175-
version: '4.0.20',
175+
version: '4.0.25',
176176
os: {
177177
os: 'linux',
178178
dist: 'debian',
179179
release: '10',
180180
},
181181
});
182182
expect(await du.getDownloadUrl()).toBe(
183-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.20.tgz'
183+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.0.25.tgz'
184184
);
185185
});
186186
});
@@ -309,7 +309,7 @@ describe('MongoBinaryDownloadUrl', () => {
309309
downloadUrl = new MongoBinaryDownloadUrl({
310310
platform: 'linux',
311311
arch: 'x64',
312-
version: '4.0.20',
312+
version: '4.0.25',
313313
os: {
314314
os: 'linux',
315315
dist: 'Linux Mint',
@@ -322,35 +322,35 @@ describe('MongoBinaryDownloadUrl', () => {
322322
it('should default to Mint Version 20, if version cannot be found in lookup table', async () => {
323323
(downloadUrl.os as LinuxOS).release = '16';
324324
expect(await downloadUrl.getDownloadUrl()).toBe(
325-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.20.tgz'
325+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz'
326326
);
327327
});
328328

329329
it('should return a archive name for Linux Mint 17', async () => {
330330
(downloadUrl.os as LinuxOS).release = '17';
331331
expect(await downloadUrl.getDownloadUrl()).toBe(
332-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-4.0.20.tgz'
332+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-4.0.25.tgz'
333333
);
334334
});
335335

336336
it('should return a archive name for Linux Mint 18', async () => {
337337
(downloadUrl.os as LinuxOS).release = '18';
338338
expect(await downloadUrl.getDownloadUrl()).toBe(
339-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.0.20.tgz'
339+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.0.25.tgz'
340340
);
341341
});
342342

343343
it('should return a archive name for Linux Mint 19', async () => {
344344
(downloadUrl.os as LinuxOS).release = '19';
345345
expect(await downloadUrl.getDownloadUrl()).toBe(
346-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.20.tgz'
346+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz'
347347
);
348348
});
349349

350350
it('should return a archive name for Linux Mint 20', async () => {
351351
(downloadUrl.os as LinuxOS).release = '20';
352352
expect(await downloadUrl.getDownloadUrl()).toBe(
353-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.20.tgz'
353+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.25.tgz'
354354
);
355355
});
356356
});

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('DryBinary', () => {
4949
/** Used for non "find-cache-dir" */
5050
let tmpDir2: tmp.DirResult;
5151
const cwdBefore = process.cwd();
52-
const version = '4.0.20';
52+
const version = '4.0.25';
5353
let opts: binary.DryMongoBinaryOptions & binary.DryMongoBinaryNameOptions;
5454
let binaryName: string;
5555
beforeAll(async () => {
@@ -158,7 +158,7 @@ describe('DryBinary', () => {
158158
let expectedPaths: binary.DryMongoBinaryPaths;
159159
let opts: Required<binary.DryMongoBinaryOptions>;
160160
beforeAll(async () => {
161-
opts = await binary.DryMongoBinary.generateOptions({ version: '4.0.20' });
161+
opts = await binary.DryMongoBinary.generateOptions({ version: '4.0.25' });
162162
delete process.env[envName(ResolveConfigVariables.PREFER_GLOBAL_PATH)];
163163
jest.spyOn(utils, 'pathExists').mockImplementation((file) => {
164164
// this is to ensure it is returning an promise
@@ -312,7 +312,7 @@ describe('DryBinary', () => {
312312
process.env[envName(ResolveConfigVariables.SYSTEM_BINARY)] = mockBinary;
313313
jest.spyOn(fspromises, 'access').mockResolvedValue(void 0);
314314

315-
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.20' });
315+
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.25' });
316316
expect(returnValue).toEqual(mockBinary);
317317
expect(binary.DryMongoBinary.binaryCache.size).toBe(0); // system binaries dont get added to the cache
318318
expect(fspromises.access).toHaveBeenCalled();
@@ -324,7 +324,7 @@ describe('DryBinary', () => {
324324
jest.spyOn(fspromises, 'access').mockRejectedValue(new Error('custom'));
325325

326326
try {
327-
await binary.DryMongoBinary.locateBinary({ version: '4.0.20' });
327+
await binary.DryMongoBinary.locateBinary({ version: '4.0.25' });
328328
fail('Expected "locateBinary" to throw');
329329
} catch (err) {
330330
expect(err.message).toEqual(
@@ -338,19 +338,19 @@ describe('DryBinary', () => {
338338
it('should return "undefined" if no binary can be found', async () => {
339339
jest.spyOn(binary.DryMongoBinary, 'generateDownloadPath').mockResolvedValue([false, 'empty']);
340340

341-
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.20' });
341+
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.25' });
342342
expect(returnValue).toBeUndefined();
343343
expect(binary.DryMongoBinary.binaryCache.size).toBe(0);
344344
expect(binary.DryMongoBinary.generateDownloadPath).toHaveBeenCalled();
345345
});
346346

347347
it('should return cached version if exists', async () => {
348348
const mockBinary = '/custom/path';
349-
binary.DryMongoBinary.binaryCache.set('4.0.20', mockBinary);
349+
binary.DryMongoBinary.binaryCache.set('4.0.25', mockBinary);
350350
jest.spyOn(binary.DryMongoBinary.binaryCache, 'get');
351351
jest.spyOn(binary.DryMongoBinary.binaryCache, 'has');
352352

353-
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.20' });
353+
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.25' });
354354
expect(returnValue).toEqual(mockBinary);
355355
expect(binary.DryMongoBinary.binaryCache.size).toBe(1);
356356
expect(binary.DryMongoBinary.binaryCache.has).toBeCalledTimes(1);
@@ -364,7 +364,7 @@ describe('DryBinary', () => {
364364
.spyOn(binary.DryMongoBinary, 'generateDownloadPath')
365365
.mockResolvedValue([true, mockBinary]);
366366

367-
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.20' });
367+
const returnValue = await binary.DryMongoBinary.locateBinary({ version: '4.0.25' });
368368
expect(returnValue).toEqual(mockBinary);
369369
expect(binary.DryMongoBinary.binaryCache.size).toBe(1);
370370
expect(binary.DryMongoBinary.binaryCache.has).toBeCalledTimes(2); // it seems like ".set" also calls ".has"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export enum ResolveConfigVariables {
2525
export const ENV_CONFIG_PREFIX = 'MONGOMS_';
2626
export const defaultValues = new Map<ResolveConfigVariables, string>([
2727
// apply app-default values here
28-
[ResolveConfigVariables.VERSION, '4.0.20'],
28+
[ResolveConfigVariables.VERSION, '4.0.25'],
2929
[ResolveConfigVariables.PREFER_GLOBAL_PATH, 'true'],
3030
[ResolveConfigVariables.RUNTIME_DOWNLOAD, 'true'],
3131
[ResolveConfigVariables.USE_HTTP, 'false'],

0 commit comments

Comments
 (0)