Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests against multiple MongoDB versions #7161

Merged
merged 53 commits into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
dc9f90d
Merge commit 'ccb045b68c5b4d983a90fa125513fc476e4e2387'
mtrezza Nov 19, 2020
4d72525
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 4, 2020
65a6bdb
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 5, 2020
50274b8
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 8, 2020
3b337cd
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 15, 2020
073f0fc
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 18, 2020
2ee5907
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 19, 2020
241a1d8
Merge remote-tracking branch 'upstream/master'
mtrezza Dec 26, 2020
4f097ce
Merge remote-tracking branch 'upstream/master'
mtrezza Jan 14, 2021
8f3ea1c
Merge remote-tracking branch 'upstream/master'
mtrezza Jan 23, 2021
4743cbc
Merge remote-tracking branch 'upstream/master'
mtrezza Jan 28, 2021
59de429
Merge remote-tracking branch 'upstream/master'
mtrezza Feb 1, 2021
ed2944f
Merge remote-tracking branch 'upstream/master'
mtrezza Feb 2, 2021
cb63152
added tests environment with mongodb 4.4.3
mtrezza Feb 2, 2021
cb84664
added CI test for mongodb 4.4.3
mtrezza Feb 2, 2021
5427c19
added CI tests for MongoDB versions 4.0, 4.2
mtrezza Feb 2, 2021
3bc43a0
improved flaky test (seems to max out the limit of simultaneous conne…
mtrezza Feb 2, 2021
b6e6071
added spec helpers to run tests only for specific MongoDB version
mtrezza Feb 2, 2021
14c42e3
addedn npm scripts to run tests against relevant mongodb versions
mtrezza Feb 2, 2021
2808854
added spec helper function to exclude specific mongodb version
mtrezza Feb 2, 2021
985d24e
added test for changed aggregate query planner results
mtrezza Feb 3, 2021
e4bf277
fixed regex test with incorrect regex syntax
mtrezza Feb 3, 2021
8425da9
fixed test where query has select no keys (empty array)
mtrezza Feb 3, 2021
b5d1d9f
added changelog entry and ordered list
mtrezza Feb 3, 2021
594f78e
fixed test that tried to simultaneously delete and build index on sam…
mtrezza Feb 3, 2021
4c33b19
added MongoDB compatibility table to readme
mtrezza Feb 3, 2021
b18c900
updated default local tests to use MongoDB 4.4.3
mtrezza Feb 3, 2021
0846662
added MongoDB badges for new versions to README
mtrezza Feb 3, 2021
416a567
fixed typo in readme
mtrezza Feb 3, 2021
b3fe5e8
added new test helper filter to contribution guide
mtrezza Feb 3, 2021
ecd6f47
fixed incorrect storage engine for mongodb 4.4
mtrezza Feb 3, 2021
b6dd613
changed CI to test MongoDB 3.6. with mmapv1 storage engine and standa…
mtrezza Feb 3, 2021
7a9e963
improved CI test description
mtrezza Feb 3, 2021
da8077c
added CI self check for new MongoDB versions
mtrezza Feb 4, 2021
034ee8f
Merge branch 'master' into fix-mongodb-4.4
mtrezza Feb 4, 2021
43c307c
fixed CI
mtrezza Feb 4, 2021
0795f93
removed CI
mtrezza Feb 4, 2021
57cb2b2
added CI
mtrezza Feb 4, 2021
3f13481
added throwing error if any of the checks failed
mtrezza Feb 4, 2021
7974419
added github action connector
mtrezza Feb 4, 2021
b0e8176
improved error message
mtrezza Feb 4, 2021
0101752
improved error messages
mtrezza Feb 4, 2021
8d549c7
improved error message
mtrezza Feb 4, 2021
16a2a7b
updated CI environment to MongoDB 3.6.22
mtrezza Feb 4, 2021
216b72d
improved error messages
mtrezza Feb 4, 2021
bfcd4a5
update CI env name
mtrezza Feb 4, 2021
6cb3ae2
updated CI env name
mtrezza Feb 4, 2021
3cbb638
improved error message
mtrezza Feb 4, 2021
424de2f
removed patch versions from CI env description
mtrezza Feb 4, 2021
d885fd5
improved status message
mtrezza Feb 4, 2021
d9b53fc
removed version range from core lib
mtrezza Feb 4, 2021
8f90104
added explicit mongodb version to redis test and node 12 test
mtrezza Feb 5, 2021
f743b0e
bumped Node 12 test to 12.20.1 (version currently recommended by AWS …
mtrezza Feb 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,25 @@ jobs:
strategy:
matrix:
include:
- name: Mongo 4.0.4, ReplicaSet, WiredTiger
MONGODB_VERSION: 4.0.4
- name: Mongo 4.4.3, ReplicaSet, WiredTiger
MONGODB_VERSION: 4.4.3
MONGODB_TOPOLOGY: replicaset
MONGODB_STORAGE_ENGINE: wiredTiger
NODE_VERSION: 10
- name: Mongo 3.6.21
- name: Mongo 4.2.12, ReplicaSet, WiredTiger
MONGODB_VERSION: 4.2.12
MONGODB_TOPOLOGY: replicaset
MONGODB_STORAGE_ENGINE: wiredTiger
NODE_VERSION: 10
- name: Mongo 4.0.22, ReplicaSet, WiredTiger
MONGODB_VERSION: 4.0.22
MONGODB_TOPOLOGY: replicaset
MONGODB_STORAGE_ENGINE: wiredTiger
NODE_VERSION: 10
- name: Mongo 3.6.21, Standalone, MMAPv1
MONGODB_VERSION: 3.6.21
MONGODB_TOPOLOGY: standalone
MONGODB_STORAGE_ENGINE: mmapv1
NODE_VERSION: 10
- name: Redis Cache
PARSE_SERVER_TEST_CACHE: redis
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.0...master)

__BREAKING CHANGES:__
- 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).
- 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).
___
- 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)
- 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)
- 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)
- 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).
- 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).
- 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)
- FIX: request.context for afterFind triggers. [#7078](https://github.com/parse-community/parse-server/pull/7078). Thanks to [dblythy](https://github.com/dblythy)
- 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)
- FIX: Winston Logger interpolating stdout to console [#7114](https://github.com/parse-community/parse-server/pull/7114). Thanks to [dplewis](https://github.com/dplewis)
- 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)
- 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)

### 4.5.0
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ If your pull request introduces a change that may affect the storage or retrieva
- `it_only_db('postgres')` // will make a test that only runs on postgres
- `it_exclude_dbs(['mongo'])` // will make a test that runs against all DB's but mongo

* If your feature is intended to work with MongoDB and PostgreSQL, you can include or exclude tests more granularly with:

- `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
- `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

#### Run Postgres setup for Parse with Docker

[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:
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<p align="center">
<img alt="MongoDB 3.6" src="https://img.shields.io/badge/mongodb-3.6-green.svg?logo=mongodb&style=flat">
<img alt="MongoDB 4.0" src="https://img.shields.io/badge/mongodb-4.0-green.svg?logo=mongodb&style=flat">
<img alt="MongoDB 4.2" src="https://img.shields.io/badge/mongodb-4.2-green.svg?logo=mongodb&style=flat">
<img alt="MongoDB 4.4" src="https://img.shields.io/badge/mongodb-4.4-green.svg?logo=mongodb&style=flat">
</p>

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

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

### Compatibility

#### MongoDB Support
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.

| Version | Latest Patch Version | End-of-Life Date | Compatibility |
|-------------|----------------------|------------------|--------------------|
| MongoDB 3.6 | 3.6.21 | April 2021 | ✅ Fully compatible |
| MongoDB 4.0 | 4.0.22 | January 2022 | ✅ Fully compatible |
| MongoDB 4.2 | 4.2.12 | TBD | ✅ Fully compatible |
| MongoDB 4.4 | 4.4.3 | TBD | ✅ Fully compatible |

### Locally
```bash
$ npm install -g parse-server mongodb-runner
Expand Down Expand Up @@ -424,11 +440,11 @@ let api = new ParseServer({
```
#### Parameters

| Parameter | Optional | Type | Default value | Example values Environment variable | Description |
|-----------|----------|--------|---------------|-----------|-----------|-------------|
| `idempotencyOptions` | yes | `Object` | `undefined` | | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS | Setting this enables idempotency enforcement for the specified paths. |
| `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/`. |
| `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`. |
| Parameter | Optional | Type | Default value | Example values | Environment variable | Description |
|----------------------------|----------|-----------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `idempotencyOptions` | yes | `Object` | `undefined` | | PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS | Setting this enables idempotency enforcement for the specified paths. |
| `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/`. |
| `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`. |

#### Notes

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"jsdoc": "3.6.3",
"jsdoc-babel": "0.5.0",
"lint-staged": "10.2.3",
"mongodb-runner": "mongodb-js/runner",
"mongodb-runner": "4.8.1",
"node-fetch": "2.6.1",
"nyc": "15.1.0",
"prettier": "2.0.5"
Expand All @@ -99,11 +99,18 @@
"lint-fix": "eslint --fix --cache ./",
"build": "babel src/ -d lib/ --copy-files",
"watch": "babel --watch src/ -d lib/ --copy-files",
"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",
"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",
"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",
"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",
"test:mongodb": "npm run test:mongodb:runnerstart --dbversion=$npm_config_dbversion && npm run test:mongodb:testonly --dbversion=$npm_config_dbversion",
"test:mongodb:4.0.22": "npm run test:mongodb --dbversion=4.0.22",
"test:mongodb:4.2.12": "npm run test:mongodb --dbversion=4.2.12",
"test:mongodb:4.4.3": "npm run test:mongodb --dbversion=4.4.3",
"posttest:mongodb": "mongodb-runner stop",
"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",
"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",
"test": "npm run testonly",
"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",
"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",
"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",
"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",
"start": "node ./bin/parse-server",
"prettier": "prettier --write '{src,spec}/{**/*,*}.js'",
"prepare": "npm run build",
Expand Down
4 changes: 4 additions & 0 deletions spec/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"expectAsync": true,
"notEqual": true,
"it_only_db": true,
"it_only_mongodb_version": true,
"fit_only_mongodb_version": true,
"it_exclude_mongodb_version": true,
"fit_exclude_mongodb_version": true,
mtrezza marked this conversation as resolved.
Show resolved Hide resolved
"it_exclude_dbs": true,
"describe_only_db": true,
"describe_only": true,
Expand Down
5 changes: 3 additions & 2 deletions spec/Auth.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

describe('Auth', () => {
const { Auth, getAuthForSessionToken } = require('../lib/Auth.js');
const Config = require('../lib/Config');
Expand Down Expand Up @@ -151,7 +153,7 @@ describe('Auth', () => {
});

describe('getRolesForUser', () => {
const rolesNumber = 300;
const rolesNumber = 100;

it('should load all roles without config', async () => {
const user = new Parse.User();
Expand Down Expand Up @@ -201,7 +203,6 @@ describe('Auth', () => {
});

it('should load all roles for different users with config', async () => {
const rolesNumber = 100;
const user = new Parse.User();
await user.signUp({
username: 'hello',
Expand Down
Loading