RUBY-3480 Sync CRUD spec tests#3011
Conversation
There was a problem hiding this comment.
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
maxServerVersioncaps from runOnRequirements for these fixtures. - Simplified fixtures by removing empty
initialDataentries and removingoutcomevalidations for $out/$merge tests. - Kept command monitoring expectations asserting presence/absence of
$readPreferenceby 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 } | |||
There was a problem hiding this comment.
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).
| - { _id: 3, x: 33 } | |
| - { _id: 3, x: 33 } | |
| - collectionName: *collection1Name | |
| databaseName: *database0Name | |
| documents: [] |
| 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 |
There was a problem hiding this comment.
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.
| - collection: | ||
| id: &collection0 collection0 | ||
| database: *database0 | ||
| collectionName: &collection0Name coll0 | ||
|
|
||
| initialData: | ||
| - collectionName: *collection0Name | ||
| databaseName: *database0Name | ||
| documents: [] | ||
|
|
||
| tests: |
There was a problem hiding this comment.
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.
| expectEvents: | ||
| - client: *client0 | ||
| events: | ||
| - commandStartedEvent: | ||
| command: | ||
| aggregate: 1 | ||
| pipeline: *outPipeline | ||
| $readPreference: *readPreference | ||
| readConcern: *readConcern | ||
| writeConcern: *writeConcern |
There was a problem hiding this comment.
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.
No description provided.