Skip to content

RUBY-3480 Sync CRUD spec tests#3011

Merged
comandeo-mongo merged 1 commit intomongodb:masterfrom
comandeo-mongo:3480
Mar 31, 2026
Merged

RUBY-3480 Sync CRUD spec tests#3011
comandeo-mongo merged 1 commit intomongodb:masterfrom
comandeo-mongo:3480

Conversation

@comandeo-mongo
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 12:01
@comandeo-mongo comandeo-mongo requested a review from a team as a code owner March 30, 2026 12:01
@comandeo-mongo comandeo-mongo requested a review from jamis March 30, 2026 12:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates unified CRUD spec YAML fixtures for sync CRUD aggregate write readPreference coverage, aligning the test definitions with the current expected spec behavior across server versions.

Changes:

  • Removed temporary maxServerVersion caps from runOnRequirements for these fixtures.
  • Simplified fixtures by removing empty initialData entries and removing outcome validations for $out/$merge tests.
  • Kept command monitoring expectations asserting presence/absence of $readPreference by server version.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
spec/spec_tests/data/crud_unified/db-aggregate-write-readPreference.yml Removes version caps and drops initialData/outcome checks for DB-level aggregate $out/$merge readPreference tests.
spec/spec_tests/data/crud_unified/aggregate-write-readPreference.yml Removes version caps and drops initialData/outcome checks for collection-level aggregate $out/$merge readPreference tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -55,16 +51,11 @@
- { _id: 1, x: 11 }
- { _id: 2, x: 22 }
- { _id: 3, x: 33 }
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

initialData no longer includes the output collection (coll1). Because set_initial_data only drops/creates collections listed in initialData, coll1 will persist across the tests in this file, making the tests more order/state dependent and potentially hiding regressions. Consider restoring an initialData entry for coll1 with empty documents (or otherwise ensuring coll1 is reset per test).

Suggested change
- { _id: 3, x: 33 }
- { _id: 3, x: 33 }
- collectionName: *collection1Name
databaseName: *database0Name
documents: []

Copilot uses AI. Check for mistakes.
Comment on lines 64 to 77
pipeline: &outPipeline
- { $match: { _id: { $gt: 1 } } }
- { $sort: { x: 1 } }
- { $out: *collection1Name }
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
aggregate: *collection0Name
pipeline: *outPipeline
$readPreference: *readPreference
readConcern: *readConcern
writeConcern: *writeConcern
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The outcome assertions for $out/$merge were removed. With only command monitoring assertions remaining, these tests no longer verify that the write stage actually produced the expected documents, which weakens coverage and may allow regressions where the command shape is correct but the write stage behavior is wrong. Consider re-adding an outcome block (or another assertion) to validate the written documents.

Copilot uses AI. Check for mistakes.
Comment on lines 41 to 46
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
documents: []

tests:
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

This file no longer defines initialData for the output collection (coll0). Since the unified test runner only resets collections listed in initialData, coll0 can persist across tests in this file and from other spec files that use the same db/collection names, which can introduce order-dependent behavior. Consider restoring an initialData entry for coll0 with empty documents to guarantee a clean starting state per test.

Copilot uses AI. Check for mistakes.
Comment on lines 61 to 70
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
aggregate: 1
pipeline: *outPipeline
$readPreference: *readPreference
readConcern: *readConcern
writeConcern: *writeConcern
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Outcome assertions were removed from the $out/$merge tests. Without checking the resulting collection contents, the tests only validate the emitted command and may miss regressions where the operation succeeds but writes unexpected data. Consider re-adding an outcome block to validate the written documents.

Copilot uses AI. Check for mistakes.
@comandeo-mongo comandeo-mongo merged commit 02014e1 into mongodb:master Mar 31, 2026
201 of 204 checks passed
@comandeo-mongo comandeo-mongo deleted the 3480 branch March 31, 2026 15:37
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