Skip to content

Commit b59517f

Browse files
authored
Add tests against multiple MongoDB versions (#7161)
* added tests environment with mongodb 4.4.3 * added CI test for mongodb 4.4.3 * added CI tests for MongoDB versions 4.0, 4.2 * improved flaky test (seems to max out the limit of simultaneous connections) * added spec helpers to run tests only for specific MongoDB version * addedn npm scripts to run tests against relevant mongodb versions * added spec helper function to exclude specific mongodb version * added test for changed aggregate query planner results * fixed regex test with incorrect regex syntax * fixed test where query has select no keys (empty array) * added changelog entry and ordered list * fixed test that tried to simultaneously delete and build index on same collection * added MongoDB compatibility table to readme * updated default local tests to use MongoDB 4.4.3 * added MongoDB badges for new versions to README * fixed typo in readme * added new test helper filter to contribution guide * fixed incorrect storage engine for mongodb 4.4 * changed CI to test MongoDB 3.6. with mmapv1 storage engine and standalone * improved CI test description * added CI self check for new MongoDB versions * fixed CI * removed CI * added CI * added throwing error if any of the checks failed * added github action connector * improved error message * improved error messages * improved error message * updated CI environment to MongoDB 3.6.22 * improved error messages * update CI env name * updated CI env name * improved error message * removed patch versions from CI env description * improved status message * removed version range from core lib * added explicit mongodb version to redis test and node 12 test * bumped Node 12 test to 12.20.1 (version currently recommended by AWS Elastic Beanstalk)
1 parent 6097e82 commit b59517f

14 files changed

+522
-114
lines changed

.github/workflows/ci.yml

+45-6
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,62 @@ env:
1111
NODE_VERSION: 10
1212
PARSE_SERVER_TEST_TIMEOUT: 20000
1313
jobs:
14+
check-ci:
15+
name: CI Self-Check
16+
timeout-minutes: 30
17+
runs-on: ubuntu-18.04
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Use Node.js ${{ matrix.NODE_VERSION }}
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
- name: Cache Node.js modules
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
31+
- name: Install dependencies
32+
run: npm ci
33+
- name: CI Self-Check
34+
run: npm run ci:check
1435
check-mongo:
1536
strategy:
1637
matrix:
1738
include:
18-
- name: Mongo 4.0.4, ReplicaSet, WiredTiger
19-
MONGODB_VERSION: 4.0.4
39+
- name: Mongo 4.4, ReplicaSet, WiredTiger
40+
MONGODB_VERSION: 4.4.3
41+
MONGODB_TOPOLOGY: replicaset
42+
MONGODB_STORAGE_ENGINE: wiredTiger
43+
NODE_VERSION: 10
44+
- name: Mongo 4.2, ReplicaSet, WiredTiger
45+
MONGODB_VERSION: 4.2.12
46+
MONGODB_TOPOLOGY: replicaset
47+
MONGODB_STORAGE_ENGINE: wiredTiger
48+
NODE_VERSION: 10
49+
- name: Mongo 4.0, ReplicaSet, WiredTiger
50+
MONGODB_VERSION: 4.0.22
2051
MONGODB_TOPOLOGY: replicaset
2152
MONGODB_STORAGE_ENGINE: wiredTiger
2253
NODE_VERSION: 10
23-
- name: Mongo 3.6.21
24-
MONGODB_VERSION: 3.6.21
54+
- name: Mongo 3.6, Standalone, MMAPv1
55+
MONGODB_VERSION: 3.6.22
56+
MONGODB_TOPOLOGY: standalone
57+
MONGODB_STORAGE_ENGINE: mmapv1
2558
NODE_VERSION: 10
2659
- name: Redis Cache
2760
PARSE_SERVER_TEST_CACHE: redis
61+
MONGODB_VERSION: 4.4.3
62+
MONGODB_TOPOLOGY: standalone
63+
MONGODB_STORAGE_ENGINE: wiredTiger
2864
NODE_VERSION: 10
29-
- name: Node 12.12.0
30-
NODE_VERSION: 12.12.0
65+
- name: Node 12.20
66+
MONGODB_VERSION: 4.4.3
67+
MONGODB_TOPOLOGY: standalone
68+
MONGODB_STORAGE_ENGINE: wiredTiger
69+
NODE_VERSION: 12.20.1
3170
name: ${{ matrix.name }}
3271
timeout-minutes: 30
3372
runs-on: ubuntu-18.04

CHANGELOG.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.0...master)
55

66
__BREAKING CHANGES:__
7-
- NEW: Added file upload restriction. File upload is now only allowed for authenticated users by default for improved security. To allow file upload also for Anonymous Users or Public, set the `fileUpload` parameter in the [Parse Server Options](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html). [#7071](https://github.com/parse-community/parse-server/pull/7071). Thanks to [dblythy](https://github.com/dblythy).
7+
- NEW: Added file upload restriction. File upload is now only allowed for authenticated users by default for improved security. To allow file upload also for Anonymous Users or Public, set the `fileUpload` parameter in the [Parse Server Options](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html). [#7071](https://github.com/parse-community/parse-server/pull/7071). Thanks to [dblythy](https://github.com/dblythy), [Manuel Trezza](https://github.com/mtrezza).
88
___
9+
- NEW: Added convenience method Parse.Cloud.sendEmail(...) to send email via email adapter in Cloud Code. [#7089](https://github.com/parse-community/parse-server/pull/7089). Thanks to [dblythy](https://github.com/dblythy)
10+
- NEW: LiveQuery support for $and, $nor, $containedBy, $geoWithin, $geoIntersects queries [#7113](https://github.com/parse-community/parse-server/pull/7113). Thanks to [dplewis](https://github.com/dplewis)
11+
- NEW: Supporting patterns in LiveQuery server's config parameter `classNames` [#7131](https://github.com/parse-community/parse-server/pull/7131). Thanks to [Nes-si](https://github.com/Nes-si)
912
- IMPROVE: Added new account lockout policy option `accountLockout.unlockOnPasswordReset` to automatically unlock account on password reset. [#7146](https://github.com/parse-community/parse-server/pull/7146). Thanks to [Manuel Trezza](https://github.com/mtrezza).
13+
- IMPROVE: Parse Server will from now on be continuously tested against all relevant MongoDB versions (minor versions). Added MongoDB compatibility table to Parse Server docs. [7161](https://github.com/parse-community/parse-server/pull/7161). Thanks to [Manuel Trezza](https://github.com/mtrezza).
1014
- IMPROVE: Optimize queries on classes with pointer permissions. [#7061](https://github.com/parse-community/parse-server/pull/7061). Thanks to [Pedro Diaz](https://github.com/pdiaz)
1115
- FIX: request.context for afterFind triggers. [#7078](https://github.com/parse-community/parse-server/pull/7078). Thanks to [dblythy](https://github.com/dblythy)
12-
- NEW: Added convenience method Parse.Cloud.sendEmail(...) to send email via email adapter in Cloud Code. [#7089](https://github.com/parse-community/parse-server/pull/7089). Thanks to [dblythy](https://github.com/dblythy)
1316
- FIX: Winston Logger interpolating stdout to console [#7114](https://github.com/parse-community/parse-server/pull/7114). Thanks to [dplewis](https://github.com/dplewis)
14-
- NEW: LiveQuery support for $and, $nor, $containedBy, $geoWithin, $geoIntersects queries [#7113](https://github.com/parse-community/parse-server/pull/7113). Thanks to [dplewis](https://github.com/dplewis)
15-
- NEW: Supporting patterns in LiveQuery server's config parameter `classNames` [#7131](https://github.com/parse-community/parse-server/pull/7131). Thanks to [Nes-si](https://github.com/Nes-si)
1617

1718
### 4.5.0
1819
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)

CONTRIBUTING.md

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ If your pull request introduces a change that may affect the storage or retrieva
7171
- `it_only_db('postgres')` // will make a test that only runs on postgres
7272
- `it_exclude_dbs(['mongo'])` // will make a test that runs against all DB's but mongo
7373

74+
* If your feature is intended to work with MongoDB and PostgreSQL, you can include or exclude tests more granularly with:
75+
76+
- `it_only_mongodb_version('>=4.4')` // will test with any version of Postgres but only with version >=4.4 of MongoDB; accepts semver notation to specify a version range
77+
- `it_exclude_mongodb_version('<4.4')` // will test with any version of Postgres and MongoDB, excluding version <4.4 of MongoDB; accepts semver notation to specify a version range
78+
7479
#### Run Postgres setup for Parse with Docker
7580

7681
[PostGIS images (select one with v2.2 or higher) on docker dashboard](https://hub.docker.com/r/postgis/postgis) is based off of the official [postgres](https://registry.hub.docker.com/_/postgres/) image and will work out-of-the-box (as long as you create a user with the necessary extensions for each of your Parse databases; see below). To launch the compatible Postgres instance, copy and paste the following line into your shell:

README.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<p align="center">
2323
<img alt="MongoDB 3.6" src="https://img.shields.io/badge/mongodb-3.6-green.svg?logo=mongodb&style=flat">
2424
<img alt="MongoDB 4.0" src="https://img.shields.io/badge/mongodb-4.0-green.svg?logo=mongodb&style=flat">
25+
<img alt="MongoDB 4.2" src="https://img.shields.io/badge/mongodb-4.2-green.svg?logo=mongodb&style=flat">
26+
<img alt="MongoDB 4.4" src="https://img.shields.io/badge/mongodb-4.4-green.svg?logo=mongodb&style=flat">
2527
</p>
2628

2729
<h2 align="center">Our Sponsors</h2>
@@ -45,6 +47,8 @@ The full documentation for Parse Server is available in the [wiki](https://githu
4547

4648
- [Getting Started](#getting-started)
4749
- [Running Parse Server](#running-parse-server)
50+
- [Compatibility](#compatibility)
51+
- [MongoDB Support](#mongodb-support)
4852
- [Locally](#locally)
4953
- [Docker](#inside-a-docker-container)
5054
- [Saving an Object](#saving-your-first-object)
@@ -84,6 +88,18 @@ Before you start make sure you have installed:
8488
- [MongoDB](https://www.mongodb.com/) or [PostgreSQL](https://www.postgresql.org/)(with [PostGIS](https://postgis.net) 2.2.0 or higher)
8589
- Optionally [Docker](https://www.docker.com/)
8690

91+
### Compatibility
92+
93+
#### MongoDB Support
94+
Parse Server is continuously tested with the most recent releases of MongoDB to ensure compatibility. The rests run against the latest patch version of each MongoDB release. We follow the [MongoDB support schedule](https://www.mongodb.com/support-policy) and only test against versions that are officially supported by MongoDB and have not reached their end-of-life date yet.
95+
96+
| Version | Latest Patch Version | End-of-Life Date | Compatibility |
97+
|-------------|----------------------|------------------|--------------------|
98+
| MongoDB 3.6 | 3.6.21 | April 2021 | ✅ Fully compatible |
99+
| MongoDB 4.0 | 4.0.22 | January 2022 | ✅ Fully compatible |
100+
| MongoDB 4.2 | 4.2.12 | TBD | ✅ Fully compatible |
101+
| MongoDB 4.4 | 4.4.3 | TBD | ✅ Fully compatible |
102+
87103
### Locally
88104
```bash
89105
$ npm install -g parse-server mongodb-runner
@@ -424,11 +440,11 @@ let api = new ParseServer({
424440
```
425441
#### Parameters
426442

427-
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
428-
|-----------|----------|--------|---------------|-----------|-----------|-------------|
429-
| `idempotencyOptions` | yes | `Object` | `undefined` | | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS | Setting this enables idempotency enforcement for the specified paths. |
430-
| `idempotencyOptions.paths`| yes | `Array<String>` | `[]` | `.*` (all paths, includes the examples below), <br>`functions/.*` (all functions), <br>`jobs/.*` (all jobs), <br>`classes/.*` (all classes), <br>`functions/.*` (all functions), <br>`users` (user creation / update), <br>`installations` (installation creation / update) | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_PATHS | An array of path patterns that have to match the request path for request deduplication to be enabled. The mount path must not be included, for example to match the request path `/parse/functions/myFunction` specifiy the path pattern `functions/myFunction`. A trailing slash of the request path is ignored, for example the path pattern `functions/myFunction` matches both `/parse/functions/myFunction` and `/parse/functions/myFunction/`. |
431-
| `idempotencyOptions.ttl` | yes | `Integer` | `300` | `60` (60 seconds) | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_TTL | The duration in seconds after which a request record is discarded from the database. Duplicate requests due to network issues can be expected to arrive within milliseconds up to several seconds. This value must be greater than `0`. |
443+
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
444+
|----------------------------|----------|-----------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
445+
| `idempotencyOptions` | yes | `Object` | `undefined` | | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS | Setting this enables idempotency enforcement for the specified paths. |
446+
| `idempotencyOptions.paths` | yes | `Array<String>` | `[]` | `.*` (all paths, includes the examples below), <br>`functions/.*` (all functions), <br>`jobs/.*` (all jobs), <br>`classes/.*` (all classes), <br>`functions/.*` (all functions), <br>`users` (user creation / update), <br>`installations` (installation creation / update) | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_PATHS | An array of path patterns that have to match the request path for request deduplication to be enabled. The mount path must not be included, for example to match the request path `/parse/functions/myFunction` specifiy the path pattern `functions/myFunction`. A trailing slash of the request path is ignored, for example the path pattern `functions/myFunction` matches both `/parse/functions/myFunction` and `/parse/functions/myFunction/`. |
447+
| `idempotencyOptions.ttl` | yes | `Integer` | `300` | `60` (60 seconds) | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_TTL | The duration in seconds after which a request record is discarded from the database. Duplicate requests due to network issues can be expected to arrive within milliseconds up to several seconds. This value must be greater than `0`. |
432448

433449
#### Notes
434450

package-lock.json

+8-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+18-7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"ws": "7.4.2"
6161
},
6262
"devDependencies": {
63+
"@actions/core": "1.2.6",
6364
"@babel/cli": "7.10.0",
6465
"@babel/core": "7.10.0",
6566
"@babel/plugin-proposal-object-rest-spread": "7.10.0",
@@ -87,23 +88,33 @@
8788
"jsdoc": "3.6.3",
8889
"jsdoc-babel": "0.5.0",
8990
"lint-staged": "10.2.3",
90-
"mongodb-runner": "mongodb-js/runner",
91+
"mongodb-runner": "4.8.1",
92+
"mongodb-version-list": "1.0.0",
9193
"node-fetch": "2.6.1",
9294
"nyc": "15.1.0",
93-
"prettier": "2.0.5"
95+
"prettier": "2.0.5",
96+
"yaml": "1.10.0"
9497
},
9598
"scripts": {
99+
"ci:check": "node ./resources/checkMongodbVersions.js",
96100
"definitions": "node ./resources/buildConfigDefinitions.js && prettier --write 'src/Options/*.js'",
97101
"docs": "jsdoc -c ./jsdoc-conf.json",
98102
"lint": "flow && eslint --cache ./",
99103
"lint-fix": "eslint --fix --cache ./",
100104
"build": "babel src/ -d lib/ --copy-files",
101105
"watch": "babel --watch src/ -d lib/ --copy-files",
102-
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=mmapv1} mongodb-runner start",
103-
"testonly": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=mmapv1} TESTING=1 jasmine",
106+
"test:mongodb:runnerstart": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=$npm_config_dbversion} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} mongodb-runner start",
107+
"test:mongodb:testonly": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=$npm_config_dbversion} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} TESTING=1 jasmine",
108+
"test:mongodb": "npm run test:mongodb:runnerstart --dbversion=$npm_config_dbversion && npm run test:mongodb:testonly --dbversion=$npm_config_dbversion",
109+
"test:mongodb:4.0.22": "npm run test:mongodb --dbversion=4.0.22",
110+
"test:mongodb:4.2.12": "npm run test:mongodb --dbversion=4.2.12",
111+
"test:mongodb:4.4.3": "npm run test:mongodb --dbversion=4.4.3",
112+
"posttest:mongodb": "mongodb-runner stop",
113+
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.4.3} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} mongodb-runner start",
114+
"testonly": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.4.3} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} TESTING=1 jasmine",
104115
"test": "npm run testonly",
105-
"posttest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=mmapv1} mongodb-runner stop",
106-
"coverage": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=mmapv1} TESTING=1 nyc jasmine",
116+
"posttest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.4.3} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} mongodb-runner stop",
117+
"coverage": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.4.3} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=wiredTiger} TESTING=1 nyc jasmine",
107118
"start": "node ./bin/parse-server",
108119
"prettier": "prettier --write '{src,spec}/{**/*,*}.js'",
109120
"prepare": "npm run build",
@@ -139,4 +150,4 @@
139150
"git add"
140151
]
141152
}
142-
}
153+
}

0 commit comments

Comments
 (0)