Skip to content

Commit

Permalink
feat(resolveConfig): update default binary version to 7.x
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
Default binary version is now "7.0.9"
  • Loading branch information
hasezoey committed Jun 5, 2024
1 parent abde8ca commit 2436d63
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ On Linux, you will also need `libcurl4` (or `libcurl3` on some older distro vers

### Configuring which mongod binary to use

The default behavior is that version `6.0.14` 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:
The default behavior is that version `7.0.9` 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:

```sh
export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.8.tgz
Expand Down Expand Up @@ -128,7 +128,7 @@ const mongod = new MongoMemoryServer({
auth?: boolean, // add "--auth" argument, dont use this directly use top-level "auth"
},
binary?: {
version?: string, // by default '6.0.14'
version?: string, // by default '7.0.9'
downloadDir?: string, // see the documentation on what is chosen by default https://nodkz.github.io/mongodb-memory-server/docs/api/config-options#download_dir
platform?: string, // by default os.platform()
arch?: string, // by default os.arch()
Expand Down
2 changes: 1 addition & 1 deletion docs/api/config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Example: `ubuntu-18.04`

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

Default: `6.0.14` (see [Mongodb Server Versions](../guides/mongodb-server-versions.md) for a complete list and policy)
Default: `7.0.9` (see [Mongodb Server Versions](../guides/mongodb-server-versions.md) for a complete list and policy)

This Option does not have a effect when [`ARCHIVE_NAME`](#archive_name) or [`DOWNLOAD_URL`](#download_url) is defined.

Expand Down
12 changes: 9 additions & 3 deletions docs/guides/migration/migrate10.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ With 10.0.0 the minimal nodejs required is `16.20.1`.

<!-- ### Mongodb Driver Version upgraded to 5.x
The used MongoDB Driver version is now `5.9.0`.
The used MongoDB Driver version is now `5.9.0`. -->

### Default binary version is now 6.x
### Default binary version is now 7.x

The default binary version has been upgraded from `5.0.x` to `6.0.x`. For more specifics see [mongodb-server-versions](../mongodb-server-versions.md). -->
The default binary version has been upgraded from `6.0.x` to `7.0.x`. For more specifics see [mongodb-server-versions](../mongodb-server-versions.md).

:::note
In mongodb `7.0.0` storage engine `ephemeralForTest` has been removed, mongodb-memory-server will automatically translate any occurrence to `wiredTiger` with a warning.

It is recommended to run the tests against a tmpfs or equivalent (default `/tmp` on linux / macos).
:::

## Non-Breaking changes / Additions

Expand Down
1 change: 1 addition & 0 deletions docs/guides/mongodb-server-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Starting with MongoDB version 5.0, the default versions for `mongodb-memory-serv

| `mongodb-memory-server-core` Version | Default MongoDB Version |
| :----------------------------------: | :---------------------: |
| 10.0.x - 10.0.x | 7.0.9 |
| 9.2.x - 9.2.x | 6.0.14 |
| 9.0.x - 9.1.x | 6.0.9 |
| 8.14.x - 8.16.x | 5.0.19 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ describe('single server replset', () => {
jest.spyOn(console, 'warn').mockImplementationOnce(() => void 0);
const replSet = await MongoMemoryReplSet.create({
replSet: { auth: { enable: true }, count: 3, storageEngine: 'ephemeralForTest' },
binary: {
// 7.0 removed "ephemeralForTest", this test is explicitly for that engine
version: '6.0.14',
},
});

utils.assertion(!utils.isNullOrUndefined(replSet.replSetOpts.auth));
Expand Down Expand Up @@ -436,7 +440,7 @@ describe('MongoMemoryReplSet', () => {
dbName: replSet.replSetOpts.dbName, // not testing this value, because its generated "randomly"
ip: '127.0.0.1',
spawn: {},
storageEngine: 'ephemeralForTest',
storageEngine: 'wiredTiger',
configSettings: {},
});
replSet.replSetOpts = { auth: { enable: true } };
Expand All @@ -451,7 +455,7 @@ describe('MongoMemoryReplSet', () => {
dbName: replSet.replSetOpts.dbName, // not testing this value, because its generated "randomly"
ip: '127.0.0.1',
spawn: {},
storageEngine: 'ephemeralForTest',
storageEngine: 'wiredTiger',
configSettings: {},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ describe('MongoMemoryServer', () => {
instance: {
storageEngine: 'ephemeralForTest',
},
binary: {
// 7.0 removed "ephemeralForTest", this test is explicitly for that engine
version: '6.0.14',
},
});

utils.assertion(!utils.isNullOrUndefined(mongoServer.instanceInfo));
Expand Down Expand Up @@ -259,6 +263,10 @@ describe('MongoMemoryServer', () => {
instance: {
storageEngine: 'ephemeralForTest',
},
binary: {
// 7.0 removed "ephemeralForTest", this test is explicitly for that engine
version: '6.0.14',
},
});

utils.assertion(!utils.isNullOrUndefined(mongoServer.instanceInfo));
Expand Down Expand Up @@ -368,9 +376,6 @@ describe('MongoMemoryServer', () => {
auth: {
enable: false,
},
instance: {
storageEngine: 'ephemeralForTest',
},
});

utils.assertion(!utils.isNullOrUndefined(mongoServer.instanceInfo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { assertion, isNullOrUndefined } from '../../util/utils';
export = async function globalSetup(): Promise<void> {
const defaultVersion = resolveConfig(ResolveConfigVariables.VERSION);
assertion(!isNullOrUndefined(defaultVersion), new Error('Default version is not defined'));
const versions = [defaultVersion, '4.0.28', '4.2.24', '4.4.28', '5.0.19', '6.0.14', '7.0.7'];
const versions = [defaultVersion, '4.0.28', '4.2.24', '4.4.28', '5.0.19', '6.0.14', '7.0.9'];
// Ensure all required versions are downloaded for tests
for (const version of versions) {
await MongoBinary.getPath({ version });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export enum ResolveConfigVariables {
/** The Prefix for Environmental values */
export const ENV_CONFIG_PREFIX = 'MONGOMS_';
/** This Value exists here, because "defaultValues" can be changed with "setDefaultValue", but this property is constant */
export const DEFAULT_VERSION = '6.0.14';
export const DEFAULT_VERSION = '7.0.9';
/** Default values for some config options that require explicit setting, it is constant so that the default values cannot be interfered with */
export const defaultValues = new Map<ResolveConfigVariables, string>([
// apply app-default values here
Expand Down

0 comments on commit 2436d63

Please sign in to comment.