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

Conversation

mtrezza
Copy link
Member

@mtrezza mtrezza commented Feb 2, 2021

New Pull Request Checklist

Issue Description

Add tests for multiple MongoDB versions.

Related issue: closes #7160

Approach

  • Added MongoDB versions in CI matrix.
  • Added spec helper it_only_mongodb_version(version) that only executes a test if the specified semver version satisfies the MongoDB version; allows to write duplicates tests for MongoDB versions and easily discard them by their semver notation once testing for a specific MongoDB version is removed from the CI.
  • Added npm scripts to easily run tests against the relevant MongoDB versions that have to pass in the CI, e.g. npm run test:mongodb:4.4.3; or simply run against any version the developer prefers with npm run test:mongodb --dbversion=[VERSION].

TODOs before merging

  • Ensure the latests patch of each officially supported MongoDB version is tested in CI
  • Ensure CI tests pass
  • Add MongoDB compatibility table to README.md
  • Add entry to changelog

@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #7161 (da89ea0) into master (5584da5) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7161      +/-   ##
==========================================
+ Coverage   93.90%   93.92%   +0.02%     
==========================================
  Files         169      169              
  Lines       12547    12547              
==========================================
+ Hits        11782    11785       +3     
+ Misses        765      762       -3     
Impacted Files Coverage Δ
src/RestQuery.js 95.52% <100.00%> (ø)
src/Controllers/DatabaseController.js 95.46% <0.00%> (-0.15%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 95.85% <0.00%> (-0.08%) ⬇️
src/RestWrite.js 94.00% <0.00%> (+0.32%) ⬆️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 93.51% <0.00%> (+0.67%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5584da5...f743b0e. Read the comment docs.

@dplewis
Copy link
Member

dplewis commented Feb 2, 2021

We did run into an issue when we where trying to migrate to Github Actions. We use 4.0.4 of mongo since it was the only version that works with the tests. You can view the conversation (trial and error) here

@mtrezza
Copy link
Member Author

mtrezza commented Feb 3, 2021

@dplewis All test pass now, they did not pass because:

  • some were poorly written and did not follow MongoDB specification, MongoDB 4.4 is more strict about that
  • some had to be adapted to different behavior in different versions of MongoDB
  • some bugs had to be fixed in Parse Server itself

In fact, Parse Server was not fully compatible since MongoDB 4.2 (2019).

To make sure this doesn't happen again, I added a compatibility table to the README. We should keep an eye on the MongoDB support policy and update the MongoDB versions we test against. Maybe subscribe our official email to release announcements. @TomWFox Any idea how we can remind ourselves regularly?

TODOs after merging this PR:

  • In April 2021 MongoDB 3.6 reaches its end of life support. We can (and I think should) then remove it from the CI tests to focus on the newer versions.
  • Regularly update the patch versions for all MongoDB minor versions; MongoDB still releases patches for versions <4.4, see compatibility table.

@mtrezza
Copy link
Member Author

mtrezza commented Feb 7, 2021

If there is no objection, I will go ahead and merge this later today.

@mtrezza mtrezza merged commit b59517f into parse-community:master Feb 7, 2021
@mtrezza mtrezza deleted the fix-mongodb-4.4 branch February 7, 2021 22:27
mtrezza added a commit to mtrezza/parse-server that referenced this pull request Feb 7, 2021
…-localization

* commit 'b59517fd68a56885c9ab73525526e42ff4003333':
  Add tests against multiple MongoDB versions (parse-community#7161)

# Conflicts:
#	CHANGELOG.md
#	README.md
#	package-lock.json
mtrezza added a commit to mtrezza/parse-server that referenced this pull request Feb 9, 2021
* commit '7f47b0427ea56214d9b0199f0fcfa4af38794e02':
  Add page localization (parse-community#7128)
  Improve contribution guide (parse-community#7075)
  fix: upgrade pg-promise from 10.9.0 to 10.9.1 (parse-community#7170)
  Add tests against multiple MongoDB versions (parse-community#7161)
  fix: upgrade mime from 2.4.7 to 2.5.0 (parse-community#7166)
  fix: upgrade pg-promise from 10.8.7 to 10.9.0 (parse-community#7168)
  fix: upgrade apollo-server-express from 2.19.1 to 2.19.2 (parse-community#7165)
  Upgrade @node-rs/bcrypt to latest version (parse-community#7159)
  Run Prettier after Definitions (parse-community#7164)
@mtrezza
Copy link
Member Author

mtrezza commented Feb 10, 2021

I noticed that the Parse Server repo only has Snyk as required passing test. Shouldn't these MongoDB tests and the others (Postgres, Node 12) be required as well? @davimacedo @dplewis

@davimacedo
Copy link
Member

Where do you see that @mtrezza ?

@mtrezza
Copy link
Member Author

mtrezza commented Feb 12, 2021

In the repo Settings > Branches > Branch Protection Rules > Edit > Require status checks to pass before merging.

@davimacedo
Copy link
Member

Yes. I've just seem it here. I believe we should include these checks. @dplewis thoughts?

@dplewis
Copy link
Member

dplewis commented Feb 12, 2021

I agree, I never noticed out of habit.

@davimacedo
Copy link
Member

I've just activated. Let's see how it works.

dplewis pushed a commit that referenced this pull request Feb 21, 2021
* 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)
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Nov 1, 2021
@mtrezza mtrezza mentioned this pull request Mar 12, 2022
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests against multiple MongoDB versions
4 participants