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 for insertion of documents with invalid _id fields #3579

Conversation

slavabobik
Copy link
Contributor

@slavabobik slavabobik commented Oct 15, 2023

Description

Add integration tests for error cases

Closes #2804.

Readiness checklist

  • I added/updated unit tests (and they pass).
  • I added/updated integration/compatibility tests (and they pass).
  • 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), Milestone (Next), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@slavabobik slavabobik requested a review from a team as a code owner October 15, 2023 18:10
@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

Merging #3579 (f5bba51) into main (4685aa7) will decrease coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3579      +/-   ##
==========================================
- Coverage   61.43%   61.31%   -0.13%     
==========================================
  Files         426      426              
  Lines       27225    27225              
==========================================
- Hits        16727    16694      -33     
- Misses       9504     9535      +31     
- Partials      994      996       +2     

see 9 files with indirect coverage changes

Flag Coverage Δ
filter-true 57.84% <ø> (-0.13%) ⬇️
hana-1 ?
integration 57.84% <ø> (-0.13%) ⬇️
mongodb-1 4.50% <ø> (ø)
postgresql-1 41.22% <ø> (+0.10%) ⬆️
postgresql-2 40.77% <ø> (+<0.01%) ⬆️
postgresql-3 39.60% <ø> (ø)
sort-false 57.84% <ø> (-0.13%) ⬇️
sqlite-1 41.13% <ø> (+0.23%) ⬆️
sqlite-2 41.30% <ø> (ø)
sqlite-3 39.51% <ø> (-0.05%) ⬇️
unit 22.36% <ø> (ø)

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

@slavabobik
Copy link
Contributor Author

@rumyantseva I've added integrations tests, could you please review it? Also can you please explain a little bit more about:
#3523 (comment)

What else we don't have is a test case where top-level _id is set as a document (a valid case, but probably rate in real life), but it's rather a separate story :)

I think this is what you mean?

{0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}: bson.D{{"_id", bson.D{{"foo", "bar"}}}},

@rumyantseva rumyantseva changed the title Added integration tests for fix invalid validation for _id field issue Add tests for insertion of documents with invalid _id fields Oct 16, 2023
@rumyantseva rumyantseva added the code/chore Code maintenance improvements label Oct 16, 2023
@rumyantseva rumyantseva added this to the Next milestone Oct 16, 2023
@rumyantseva rumyantseva enabled auto-merge (squash) October 16, 2023 08:53
Copy link
Contributor

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

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

LGTM!

@slavabobik my message was that we don't have any test cases where _id is a document. I expect some tests will need to be adjusted if we add such a case, and this is why I think it should be a separate story.

@rumyantseva
Copy link
Contributor

P.S. I created an issue to illustrate and discuss my question: #3587.

@rumyantseva rumyantseva requested review from a team and noisersup October 16, 2023 10:03
Copy link
Member

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@rumyantseva rumyantseva merged commit 9d3a3e1 into FerretDB:main Oct 16, 2023
28 of 30 checks passed
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.

Invalid validation for _id field
3 participants