Skip to content

Conversation

Moumouls
Copy link
Member

@Moumouls Moumouls commented Sep 13, 2025

Pull Request

Issue

Closes: Mongodb runner clean issue

Approach

Update the package, and switch to mongodb exec to automatically kill mongo process

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Summary by CodeRabbit

  • Chores
    • Updated MongoDB runner dependency.
    • Removed legacy test hooks and outdated scripts.
  • Tests
    • Simplified MongoDB test execution to a single command.
    • Added a coverage command for MongoDB tests.
    • Standardized test scripts to use the new execution flow.
  • CI
    • Streamlined MongoDB check to use the new coverage command.
    • Coverage upload behavior remains unchanged.

Copy link

parse-github-assistant bot commented Sep 13, 2025

🚀 Thanks for opening this pull request!

Copy link

coderabbitai bot commented Sep 13, 2025

📝 Walkthrough

Walkthrough

The PR updates MongoDB test orchestration by switching npm scripts to use mongodb-runner exec, removes pretest/posttest hooks and old runner scripts, adds a coverage:mongodb script, bumps mongodb-runner from 5.8.3 to 5.9.3, and updates the CI workflow to call the new coverage:mongodb script.

Changes

Cohort / File(s) Summary of Changes
Dev dependency bump
package.json
Updated devDependency: mongodb-runner 5.8.3 → 5.9.3.
Test script rework
package.json
Replaced runner-based start/stop flow with mongodb-runner exec for tests; removed pretest/posttest; removed legacy scripts (test:mongodb:runnerstart, test:mongodb:testonly, test:mongodb); updated test to invoke mongodb-runner exec and call npm run testonly; introduced/updated specific MongoDB version test scripts to use exec.
Coverage orchestration
package.json
Added coverage:mongodb script using mongodb-runner exec to run coverage with MongoDB.
CI workflow update
.github/workflows/ci.yml
In MongoDB job, replaced separate pretest and coverage steps with single npm run coverage:mongodb; coverage upload step unchanged.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Developer/CI
    participant NPM as npm scripts
    participant MR as mongodb-runner
    participant App as Test Runner

    Dev->>NPM: npm run test / coverage:mongodb
    NPM->>MR: exec -- mongo start + run command
    MR->>App: npm run testonly / coverage
    App-->>MR: exit code
    MR-->>NPM: propagate exit code
    NPM-->>Dev: success/failure

    rect rgba(220,240,255,0.4)
    note over NPM,MR: New flow uses single-process<br/>mongodb-runner exec (no pre/post hooks)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description includes the required headings and tasks sections and clearly outlines the approach, but the Issue section does not contain a valid GitHub issue link in the required “Closes:” format, instead using plain text “Mongodb runner clean issue” which does not link to a specific issue. Please update the Issue section to include a proper GitHub issue reference by replacing “Mongodb runner clean issue” with the issue number or URL in the format “Closes: #<issue_number>” or “Closes: https://github.com/…/<issue_number>” to satisfy the template requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title succinctly captures the core issue addressed by the pull request—ensuring MongoDB test instances are properly terminated—and correctly prefixes it as a CI-related fix, matching the main changes to the test orchestration and runner cleanup. It is specific, clear, and directly related to the PR’s objective of resolving the ESRCH error by updating the MongoDB runner.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Sep 13, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@Moumouls Moumouls changed the title chore: update mongodb runner to fix ESRCH error fix: update mongodb runner to fix ESRCH error Sep 13, 2025
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: update mongodb runner to fix ESRCH error fix: Update mongodb runner to fix ESRCH error Sep 13, 2025
@Moumouls
Copy link
Member Author

@mtrezza for current active contributors, they need to run the "clean:mongodb" script to prune some old ref, then the upgrade of the package seems to fix the issue 🎉

@Moumouls Moumouls changed the title fix: Update mongodb runner to fix ESRCH error fix: Update mongodb runner to fix ESRCH error when running tests Sep 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
CONTRIBUTING.md (1)

518-519: Good addition; consider surfacing this under Troubleshooting, too.

The note is helpful and scoped. To improve discoverability, mirror this line under the “Troubleshooting” section (Lines 217–231) with the same command.

package.json (1)

140-146: Nice: dedicated cleanup script. Optional: add a “clean:testenv” combo.

A convenience alias helps when CI/local runs leave stale state. Example:

   "posttest": "cross-env mongodb-runner stop --all",
   "clean:mongodb": "cross-env mongodb-runner prune",
+  "clean:testenv": "cross-env mongodb-runner stop --all && cross-env mongodb-runner prune",
   "coverage": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=8.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} TESTING=1 nyc jasmine",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82fdb0d and df884ec.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • CONTRIBUTING.md (1 hunks)
  • package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: Node 20
  • GitHub Check: MongoDB 8, ReplicaSet
  • GitHub Check: PostgreSQL 15, PostGIS 3.4
  • GitHub Check: Docker Build
  • GitHub Check: MongoDB 7, ReplicaSet
  • GitHub Check: PostgreSQL 15, PostGIS 3.3
  • GitHub Check: Node 18
  • GitHub Check: PostgreSQL 17, PostGIS 3.5
  • GitHub Check: MongoDB 6, ReplicaSet
  • GitHub Check: PostgreSQL 15, PostGIS 3.5
  • GitHub Check: Redis Cache
  • GitHub Check: PostgreSQL 16, PostGIS 3.5
🔇 Additional comments (1)
package.json (1)

106-106: Provide upstream changelog/commit proving ESRCH ('kill ESRCH') fix in mongodb-runner v5.9.3

No release note or changelog entry explicitly mentions an ESRCH / "kill ESRCH" cleanup fix in v5.9.3. Add a direct link to the upstream changelog/commit/PR in the PR description (or a short note here) showing the fix so reviewers can verify the rationale for the version bump.

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 13, 2025
Copy link

codecov bot commented Sep 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.01%. Comparing base (7b5395c) to head (b3967f0).
⚠️ Report is 2 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #9860   +/-   ##
=======================================
  Coverage   93.01%   93.01%           
=======================================
  Files         187      187           
  Lines       15096    15096           
  Branches      174      174           
=======================================
  Hits        14041    14041           
  Misses       1043     1043           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Moumouls
Copy link
Member Author

note: it seems that the update don't entirely fix the issue, i need to check additional things

@Moumouls
Copy link
Member Author

Moumouls commented Sep 21, 2025

okay @mtrezza switched the test system to mongo exec, in case of test failure mongo process is correctly killed, i removed some useless scripts now.

Tell me what you think !

Feel free to checkout my PR :)

@Moumouls
Copy link
Member Author

Note: @mtrezza An even better approach could be to use the dynamically generated Mongo URI (currently forced to port 27017). This way, even if a developer has another process running, or runs two tests in parallel, it would still work. However, this is quite a specific case. I think the priority here is to have a clean and easy contributing system, and right now the MongoDB runner issue is tedious during the testing phase.

@Moumouls
Copy link
Member Author

nice it seems that everything pass :)

@Moumouls Moumouls requested review from mtrezza and a team September 21, 2025 18:41
@Moumouls
Copy link
Member Author

ping @parse-community/server-review

@mtrezza
Copy link
Member

mtrezza commented Sep 30, 2025

Re-running docker CI

@mtrezza mtrezza changed the title fix: Update mongodb runner to fix ESRCH error when running tests ci: Fix MongoDB test instance not terminated after running tests Sep 30, 2025
@mtrezza mtrezza merged commit 389de84 into parse-community:alpha Sep 30, 2025
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants