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 more tests for $set and $addFields aggregation stages #2844

Merged
merged 3 commits into from
Jun 16, 2023

Conversation

chilagrow
Copy link
Member

@chilagrow chilagrow commented Jun 15, 2023

Description

Closes #2590.

  • Added tests to increase test coverage and check error messages
  • Moved validation of aggregation expression to stages package

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration/compatibility tests.
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@chilagrow chilagrow added the code/chore Code maintenance improvements label Jun 15, 2023
@chilagrow chilagrow self-assigned this Jun 15, 2023
@chilagrow chilagrow changed the title Test error messages for $set and $addFields Add more tests for $set and $addFields aggregation stages Jun 15, 2023
@chilagrow chilagrow marked this pull request as ready for review June 15, 2023 06:31
@chilagrow chilagrow requested a review from a team as a code owner June 15, 2023 06:31
@chilagrow chilagrow requested review from AlekSi and rumyantseva June 15, 2023 06:31
@chilagrow chilagrow enabled auto-merge (squash) June 15, 2023 06:31
@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Merging #2844 (eb7c0f0) into main (c22588d) will decrease coverage by 5.67%.
The diff coverage is 60.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2844      +/-   ##
==========================================
- Coverage   63.86%   58.19%   -5.67%     
==========================================
  Files         445      446       +1     
  Lines       22734    22745      +11     
==========================================
- Hits        14518    13237    -1281     
- Misses       7261     8532    +1271     
- Partials      955      976      +21     
Impacted Files Coverage Δ
...ernal/handlers/common/aggregations/stages/group.go 88.53% <0.00%> (ø)
internal/handlers/common/validate.go 76.92% <ø> (+40.08%) ⬆️
...al/handlers/common/aggregations/stages/validate.go 59.01% <59.01%> (ø)
.../handlers/common/aggregations/stages/add_fields.go 50.00% <75.00%> (-23.92%) ⬇️
...nternal/handlers/common/aggregations/stages/set.go 76.92% <75.00%> (+3.01%) ⬆️

... and 43 files with indirect coverage changes

Flag Coverage Δ
integration 51.09% <60.00%> (-5.88%) ⬇️
mongodb 4.98% <0.00%> (?)
pg 50.91% <60.00%> (-6.06%) ⬇️
shard-1 43.85% <60.00%> (+2.67%) ⬆️
shard-2 41.69% <0.00%> (-3.19%) ⬇️
shard-3 ?
unit 24.94% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@chilagrow chilagrow requested review from a team, w84thesun and noisersup June 15, 2023 06:31
@chilagrow
Copy link
Member Author

👋 @shibasisp I added more tests and moved aggregation specific code from common package.

@AlekSi AlekSi added this to the Next milestone Jun 15, 2023
Copy link
Member

@noisersup noisersup left a comment

Choose a reason for hiding this comment

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

Good idea to move validateExpression. LGTM!

Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

LGTM!

@chilagrow chilagrow merged commit 1aa0465 into FerretDB:main Jun 16, 2023
@shibasisp
Copy link
Contributor

Thank you @chilagrow. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement simple $addFields/$set aggregation pipeline stages
5 participants