Skip to content

Commit cab439e

Browse files
committed
Merge branch 'beta'
2 parents 2dbe628 + c809f1c commit cab439e

File tree

32 files changed

+3270
-3179
lines changed

32 files changed

+3270
-3179
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
# TODO: replace "17.x" with "18.x" when 18 releases
21-
node-version: [12.x, 14.x, 16.x, 17.x]
20+
node-version: [12.x, 14.x, 16.x, 18.x]
2221
steps:
2322
- uses: actions/checkout@v3
2423
if: github.event.inputs.git-ref == ''

CHANGELOG.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,115 @@
1+
## [8.6.0-beta.8](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.7...v8.6.0-beta.8) (2022-05-23)
2+
3+
4+
### Reverts
5+
6+
* Revert "test(MongoMemoryReplSet): enable debug for often open-handle test" ([29e11e1](https://github.com/nodkz/mongodb-memory-server/commit/29e11e1a94ece0f4dcf5d61b629844d9f0ef6278))
7+
8+
## [8.6.0-beta.7](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.6...v8.6.0-beta.7) (2022-05-23)
9+
10+
11+
### Dependencies
12+
13+
* **@types/jest:** upgrade to version 27.5.1 ([7d678c7](https://github.com/nodkz/mongodb-memory-server/commit/7d678c7231cf5677e4e572c64ac596f83377127d))
14+
* **@typescript-eslint/*:** upgrade to version 5.26.0 ([b7f53af](https://github.com/nodkz/mongodb-memory-server/commit/b7f53af7ce32c201c35757bbe600ff6ce7c7753c))
15+
* **doctoc:** upgrade to version 2.2.0 ([7591372](https://github.com/nodkz/mongodb-memory-server/commit/7591372c8679f40a32ee451d14e340dbf2685f10))
16+
* **eslint:** upgrade to version 8.16.0 ([1b19581](https://github.com/nodkz/mongodb-memory-server/commit/1b1958188325a64c828ca5528ac0706f50ed42da))
17+
* **jest:** upgrade to version 28.1.0 ([1ef0f1f](https://github.com/nodkz/mongodb-memory-server/commit/1ef0f1f8358b98701459521a4a837ee710a592db))
18+
* **ts-jest:** upgrade to version 28.0.2 ([8b8a40d](https://github.com/nodkz/mongodb-memory-server/commit/8b8a40dd9102059efc9b858566c24d9746951ca3))
19+
20+
## [8.6.0-beta.6](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.5...v8.6.0-beta.6) (2022-05-19)
21+
22+
23+
### Fixes
24+
25+
* **MongoBinaryDownloadUrl::translateArch:** add deprecation notice for "ia32" ([2614d18](https://github.com/nodkz/mongodb-memory-server/commit/2614d181c4cecf96540ca8c52d44b8be7fe4cf12)), closes [#638](https://github.com/nodkz/mongodb-memory-server/issues/638)
26+
* **MongoMemoryServer::createAuth:** handle connection erroring and maybe not closing ([9bad913](https://github.com/nodkz/mongodb-memory-server/commit/9bad91302b503c7627829ae2359fb8832909b7ac))
27+
28+
## [8.6.0-beta.5](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.4...v8.6.0-beta.5) (2022-05-19)
29+
30+
31+
### Features
32+
33+
* **MongoBinaryDownloadUrl:** add archive generation for gentoo ([39b0a3d](https://github.com/nodkz/mongodb-memory-server/commit/39b0a3da5253180e5a87dec61cfd33258bd6d68d))
34+
35+
## [8.6.0-beta.4](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.3...v8.6.0-beta.4) (2022-05-04)
36+
37+
38+
### Features
39+
40+
* **MongoMemoryReplSet:** change generic "instanceinfo missing" errors to "InstanceInfoError" ([27934a4](https://github.com/nodkz/mongodb-memory-server/commit/27934a4420ac7347248039e7f23886de3b3f419a))
41+
42+
43+
### Style
44+
45+
* **MongoMemoryReplSet::_initReplSet:** add todo ([884bda5](https://github.com/nodkz/mongodb-memory-server/commit/884bda5d49adc8eb0f2c48b0e09d2a05c643cfbb))
46+
* **MongoMemoryReplSet::stop:** rename internal variable to make more sense ([a86c321](https://github.com/nodkz/mongodb-memory-server/commit/a86c321a9340ffc0de5eff0a709bcfc2cf21c870))
47+
* **MongoMemoryServer::createAuth:** change comment to make more sense ([4df5b41](https://github.com/nodkz/mongodb-memory-server/commit/4df5b4182d1a09fed673dcab8ecd30421e2b4797))
48+
49+
50+
### Refactor
51+
52+
* change uses of deprecated ".stop(false)" to explicit object ([dbcd00a](https://github.com/nodkz/mongodb-memory-server/commit/dbcd00a8342f2293c26d103523c7f0828492c974))
53+
54+
## [8.6.0-beta.3](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.2...v8.6.0-beta.3) (2022-05-03)
55+
56+
57+
### Features
58+
59+
* update binary 4.4 to 4.4.13 ([ddaf3f9](https://github.com/nodkz/mongodb-memory-server/commit/ddaf3f988efd85fa71f72dcc94aa3950dfda6f0a))
60+
61+
62+
### Style
63+
64+
* **DryMongoBinary:** add tsdoc to interfaces ([ba0349c](https://github.com/nodkz/mongodb-memory-server/commit/ba0349ca7373e4974e449a1da270ec1f72edb490))
65+
* **MongoBinaryDownload::makeMD5Check:** change variable names to better represent what they do ([f8c2f05](https://github.com/nodkz/mongodb-memory-server/commit/f8c2f05c7b307a597076fbfef09d0bc9d4e45872))
66+
* **resolveConfig:** add tsdoc to some values and interfaces ([9b9f327](https://github.com/nodkz/mongodb-memory-server/commit/9b9f327a3a952ce155129e3d08ec54ba5406802c))
67+
* **resolveConfig:** remove commented out variable ([ac854c9](https://github.com/nodkz/mongodb-memory-server/commit/ac854c920ca53c55f8cb249533de7bffe4735ad9))
68+
69+
## [8.6.0-beta.2](https://github.com/nodkz/mongodb-memory-server/compare/v8.6.0-beta.1...v8.6.0-beta.2) (2022-05-03)
70+
71+
72+
### Features
73+
74+
* **MongoBinaryDownloadUrl::getDebianVersionString:** use debian11 when possible ([8100b2f](https://github.com/nodkz/mongodb-memory-server/commit/8100b2ff42b404831d8f87f7f2040df528f33a09))
75+
* update binary 4.0 to 4.0.28 ([f26f739](https://github.com/nodkz/mongodb-memory-server/commit/f26f73920edfbf55c09e8b0e1df633fa89a6b251))
76+
* update binary 4.2 to 4.2.18 ([3a47739](https://github.com/nodkz/mongodb-memory-server/commit/3a477395f4730b2455ac4260f713d252d5033c9c))
77+
* update binary 4.4 to 4.4.12 ([cde2a4a](https://github.com/nodkz/mongodb-memory-server/commit/cde2a4a3fdc7631045cdbf8251611f87dbf26bad))
78+
* update binary 5.0 to 5.0.8 ([a56e02b](https://github.com/nodkz/mongodb-memory-server/commit/a56e02b7a1dfa889a57dbed3bd6bcf0d6fece9d1))
79+
80+
81+
### Style
82+
83+
* **MongoBinaryDownloadUrl:** add more todo notes ([1a1bfa7](https://github.com/nodkz/mongodb-memory-server/commit/1a1bfa7521a01133c774a47811a90edb8a970947))
84+
* **MongoBinaryDownloadUrl:** add todo for ubuntu "14" default ([75d8d24](https://github.com/nodkz/mongodb-memory-server/commit/75d8d244133f0c2c4e7da67886294d44f4005a11))
85+
* **MongoBinaryDownloadUrl:** change comment to be more helpful ([2f70f53](https://github.com/nodkz/mongodb-memory-server/commit/2f70f5378bd26490df8c664c56058b630e06296d))
86+
87+
## [8.6.0-beta.1](https://github.com/nodkz/mongodb-memory-server/compare/v8.5.3-beta.1...v8.6.0-beta.1) (2022-05-03)
88+
89+
90+
### Features
91+
92+
* add environment variable to use archive name for binary name ([2fc0e1a](https://github.com/nodkz/mongodb-memory-server/commit/2fc0e1a52295e88dd78505fff03613a6a0741c07)), closes [#609](https://github.com/nodkz/mongodb-memory-server/issues/609)
93+
94+
95+
### Dependencies
96+
97+
* **@types/jest:** upgrade to version 27.5.0 ([7749b59](https://github.com/nodkz/mongodb-memory-server/commit/7749b595709055dc56e62cb769a36178da57e1f7))
98+
* **@typescript-eslint/*:** upgrade to version 5.22.0 ([e495884](https://github.com/nodkz/mongodb-memory-server/commit/e495884991e94c03fc8a1f082fe83db1aa183881))
99+
* **commitlint:** upgrade to version 16.2.4 ([ad3b242](https://github.com/nodkz/mongodb-memory-server/commit/ad3b242de7df80e74aeb17efe053f3b415ee14c7))
100+
* **eslint:** upgrade to version 8.14.0 ([08fb188](https://github.com/nodkz/mongodb-memory-server/commit/08fb188a6cb90a8ad5e3fdc16792b02f4dabb6e2))
101+
* **jest:** upgrade to version 28.0.3 ([1521838](https://github.com/nodkz/mongodb-memory-server/commit/15218382d94bdd4402507b11ae88ea99f9a45970))
102+
* **tslib:** upgrade to version 2.4.0 ([0f4713d](https://github.com/nodkz/mongodb-memory-server/commit/0f4713db2ec091d2fca7a3627f9dab0159c5e93d))
103+
104+
### [8.5.3-beta.1](https://github.com/nodkz/mongodb-memory-server/compare/v8.5.2...v8.5.3-beta.1) (2022-05-03)
105+
106+
107+
Note: this release is a "error" because this change was included earlier, but had the wrong merge branch on merge
108+
109+
### Fixes
110+
111+
* **MongoBinaryDownloadUrl.ts:** Add current openSUSE Leap relase version ([2904d7e](https://github.com/nodkz/mongodb-memory-server/commit/2904d7e88e9c4db1a68a071d5994b4c4b30070e2))
112+
1113
### [8.5.2](https://github.com/nodkz/mongodb-memory-server/compare/v8.5.1...v8.5.2) (2022-04-29)
2114

3115

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ On Linux, you will also need `libcurl4` (or `libcurl3` on some older distro vers
8686

8787
### Configuring which mongod binary to use
8888

89-
The default behavior is that version `5.0.3` 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:
89+
The default behavior is that version `5.0.8` 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:
9090

9191
```sh
9292
export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.8.tgz
@@ -128,7 +128,7 @@ const mongod = new MongoMemoryServer({
128128
args?: string[], // by default no additional arguments, any additional command line arguments for `mongod` `mongod` (ex. ['--notablescan'])
129129
},
130130
binary: {
131-
version?: string, // by default '5.0.3'
131+
version?: string, // by default '5.0.8'
132132
downloadDir?: string, // by default node_modules/.cache/mongodb-memory-server/mongodb-binaries
133133
platform?: string, // by default os.platform()
134134
arch?: string, // by default os.arch()

docs/api/config-options.md

Lines changed: 7 additions & 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: `5.0.3`
42+
Default: `5.0.8`
4343

4444
Common MongoDB Version formats (`X` is a number):
4545

@@ -128,6 +128,12 @@ Option `USE_HTTP` is used to use `http` over `https`
128128

129129
Default: `false`
130130

131+
### USE_ARCHIVE_NAME_FOR_BINARY_NAME
132+
133+
Option `USE_ARCHIVE_NAME_FOR_BINARY_NAME` is used to use the archive name as binary name
134+
135+
Default: `false`
136+
131137
## How to use them in the package.json
132138

133139
To use the config options in the `package.json`, they need to be camelCased (and without `_`), and need to be in the property `config.mongodbMemoryServer`

docs/guides/error-warning-details.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,12 @@ Example: `ReplSet Count needs to be 1 or higher! (specified count: "${count}")`
167167

168168
Details:
169169
ReplSet count (like `new MongoMemoryReplSet({ replSet: { count: 0 } })`) needs to be `1` or higher
170+
171+
## Deprecation Codes
172+
173+
### MMS001
174+
175+
Code: `MMS001`
176+
Message: `mongodb-memory-server will fully drop support for ia32 in 9.0`
177+
178+
In the major version `9.0` MMS will fully drop support for the architecture `ia32` (`i386` / `i686`), because MongoDB stopped supporting the architecture past 3.x, and MMS never full supported 3.6 or lower anyway, see [this issue #638 for tracking](https://github.com/nodkz/mongodb-memory-server/issues/638).

docs/guides/mongodb-server-versions.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Starting with MongoDB version 5.0, the default versions for `mongodb-memory-serv
3131

3232
| `mongodb-memory-server-core` Version | Default MongoDB Version |
3333
| :----------------------------------: | :---------------------: |
34-
| 8.0.x - 8.0.x | 5.0.3 |
34+
| 8.6.x - 8.6.x | 5.0.8 |
35+
| 8.0.x - 8.5.x | 5.0.3 |
3536
| 7.5.x - 7.5.x | 4.0.27 |
3637
| 7.0.x - 7.4.x | 4.0.25 |
3738
| 6.4.x - 6.9.x | 4.0.14 |
@@ -45,8 +46,8 @@ If the branch is named like `old/`, then it means that this package will not be
4546

4647
| Package Name | Provided MongoDB Version | Current Branch |
4748
| :---------------------------------: | :----------------------: | :------------: |
48-
| `mongodb-memory-server-global-4.4` | 4.4.10 | `master` |
49-
| `mongodb-memory-server-global-4.2` | 4.2.17 | `master` |
50-
| `mongodb-memory-server-global-4.0` | 4.0.27 | `master` |
49+
| `mongodb-memory-server-global-4.4` | 4.4.13 | `master` |
50+
| `mongodb-memory-server-global-4.2` | 4.2.18 | `master` |
51+
| `mongodb-memory-server-global-4.0` | 4.0.28 | `master` |
5152
| `mongodb-memory-server-global-3.6` | 3.6.23 | `old/7.x` |
5253
| `mongodb-memory-server-global-3.4` | 3.4.20 | `old/6.x` |

docs/guides/supported-systems.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ There are no official mongodb builds for Arch Distributions, but the `ubuntu` bi
126126
Because Arch* dosnt base on ubuntu, there is no specific ubuntu version associated with an arch version, so it defaults to highest supported `ubuntu` version
127127
:::
128128

129+
### Gentoo
130+
131+
<span class="badge badge--warning">Untested</span> <span class="badge badge--danger">Unsupported</span>
132+
133+
There are no official mongodb builds for Gentoo Distributions, but the `debian` binaries work on most Gentoo systems, so they are used<br/>
134+
:::note
135+
Because Gentoo dosnt base on debian, there is no specific debian version associated with an gentoo version, so it defaults to highest supported `debian` version
136+
:::
137+
129138
### Alpine
130139

131140
<span class="badge badge--danger">Unsupported</span>

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@
55
"description": "In-memory MongoDB Server. Designed with testing in mind, the server will allow you to connect your favourite ODM or client library to the MongoDB Server and run integration tests isolated from each other.",
66
"repository": "https://github.com/nodkz/mongodb-memory-server",
77
"devDependencies": {
8-
"@commitlint/cli": "16.2.3",
9-
"@commitlint/config-conventional": "16.2.1",
8+
"@commitlint/cli": "16.2.4",
9+
"@commitlint/config-conventional": "16.2.4",
1010
"@google/semantic-release-replace-plugin": "1.1.0",
1111
"@semantic-release/changelog": "5.0.1",
1212
"@semantic-release/commit-analyzer": "8.0.1",
1313
"@semantic-release/git": "9.0.0",
1414
"@semantic-release/github": "7.2.3",
1515
"@semantic-release/npm": "7.1.3",
1616
"@semantic-release/release-notes-generator": "9.0.3",
17-
"@types/jest": "^27.4.1",
17+
"@types/jest": "^27.5.1",
1818
"@types/node": "~14.14.45",
19-
"@typescript-eslint/eslint-plugin": "5.19.0",
20-
"@typescript-eslint/parser": "5.19.0",
21-
"commitlint": "16.2.3",
19+
"@typescript-eslint/eslint-plugin": "5.26.0",
20+
"@typescript-eslint/parser": "5.26.0",
21+
"commitlint": "16.2.4",
2222
"conventional-changelog-conventionalcommits": "4.6.3",
2323
"cross-env": "7.0.3",
24-
"doctoc": "2.1.0",
25-
"eslint": "8.13.0",
24+
"doctoc": "2.2.0",
25+
"eslint": "8.16.0",
2626
"eslint-config-prettier": "^8.5.0",
2727
"eslint-plugin-prettier": "4.0.0",
2828
"husky": "7.0.4",
29-
"jest": "27.5.1",
29+
"jest": "28.1.0",
3030
"lint-staged": "11.2.6",
3131
"prettier": "2.6.2",
3232
"semantic-release": "17.4.7",
33-
"ts-jest": "27.1.4",
33+
"ts-jest": "28.0.2",
3434
"typescript": "4.4.4"
3535
},
3636
"workspaces": {

packages/mongodb-memory-server-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mongodb-memory-server-core",
3-
"version": "8.5.2",
3+
"version": "8.6.0-beta.8",
44
"description": "MongoDB Server for testing (core package, without autodownload). The server will allow you to connect your favourite ODM or client library to the MongoDB Server and run parallel integration tests isolated from each other.",
55
"main": "lib/index",
66
"types": "lib/index.d.ts",
@@ -53,7 +53,7 @@
5353
"semver": "^7.3.7",
5454
"tar-stream": "^2.1.4",
5555
"tmp": "^0.2.1",
56-
"tslib": "^2.3.1",
56+
"tslib": "^2.4.0",
5757
"uuid": "^8.3.1",
5858
"yauzl": "^2.10.0"
5959
},

packages/mongodb-memory-server-core/src/MongoMemoryReplSet.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
364364

365365
log('ensureAsync chain threw a Error: ', err);
366366

367-
await this.stop(false); // still try to close the instance that was spawned, without cleanup for investigation
367+
await this.stop({ doCleanup: false, force: false }); // still try to close the instance that was spawned, without cleanup for investigation
368368

369369
this.stateChange(MongoMemoryReplSetStates.stopped);
370370

@@ -503,7 +503,9 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
503503
log('stop: state is "stopped", trying to stop / kill anyway');
504504
}
505505

506-
const bool = await Promise.all(this.servers.map((s) => s.stop(false)))
506+
const successfullyStopped = await Promise.all(
507+
this.servers.map((s) => s.stop({ doCleanup: false, force: false }))
508+
)
507509
.then(() => {
508510
this.stateChange(MongoMemoryReplSetStates.stopped);
509511

@@ -517,8 +519,8 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
517519
});
518520

519521
// return early if the instances failed to stop
520-
if (!bool) {
521-
return bool;
522+
if (!successfullyStopped) {
523+
return false;
522524
}
523525

524526
if (cleanup.doCleanup) {
@@ -674,18 +676,20 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
674676
(server) => server.instanceInfo?.instance.isInstancePrimary
675677
);
676678
assertion(!isNullOrUndefined(primary), new Error('No Primary found'));
679+
// this should be defined at this point, but is checked anyway (thanks to types)
677680
assertion(
678681
!isNullOrUndefined(primary.instanceInfo),
679-
new Error('Primary dosnt have "instanceInfo" defined') // TODO: change to "InstanceInfoError"
682+
new InstanceInfoError('_initReplSet authIsObject primary')
680683
);
681684

682685
await primary.createAuth(primary.instanceInfo);
683686
this._ranCreateAuth = true;
684687

688+
// TODO: maybe change the static "isInMemory" to be for each server individually, based on "storageEngine", not just the first one
685689
if (!isInMemory) {
686690
log('_initReplSet: closing connection for restart');
687691
await con.close(); // close connection in preparation for "stop"
688-
await this.stop(false); // stop all servers for enabling auth
692+
await this.stop({ doCleanup: false, force: false }); // stop all servers for enabling auth
689693
log('_initReplSet: starting all server again with auth');
690694
await this.initAllServers(); // start all servers again with "auth" enabled
691695

@@ -761,8 +765,9 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
761765
new Promise<void>((res, rej) => {
762766
const instanceInfo = server.instanceInfo;
763767

768+
// this should be defined at this point, but is checked anyway (thanks to types)
764769
if (isNullOrUndefined(instanceInfo)) {
765-
return rej(new Error('_waitForPrimary - instanceInfo not present')); // TODO: change to "InstanceInfoError"
770+
return rej(new InstanceInfoError('_waitForPrimary Primary race'));
766771
}
767772

768773
instanceInfo.instance.once(MongoInstanceEvents.instancePrimary, res);

0 commit comments

Comments
 (0)