Skip to content

Commit dce2c48

Browse files
authored
DRIVERS-1958: Do not expect readConcern for pre-4.2 servers (#1081)
aggregate-write-readPreference tests use client-level readConcern and writeConcern options to assert that they are still inherited and passed in the aggregate command; however, readConcern is generally not supported for write stages in server versions prior to 4.2. As noted in the test comments, pre-4.2 servers may still allow a "local" read concern anyway, but some drivers may avoid inheriting a client-level read concern for pre-4.2. Skipping these tests for pre-4.2 servers avoids any ambiguity.
1 parent eead554 commit dce2c48

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

source/crud/tests/unified/aggregate-write-readPreference.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
"description": "Aggregate with $out omits read preference for pre-5.0 server",
182182
"runOnRequirements": [
183183
{
184+
"minServerVersion": "4.2",
184185
"maxServerVersion": "4.4.99",
185186
"serverless": "forbid"
186187
}

source/crud/tests/unified/aggregate-write-readPreference.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ tests:
8787

8888
- description: "Aggregate with $out omits read preference for pre-5.0 server"
8989
runOnRequirements:
90-
- maxServerVersion: "4.4.99"
90+
# MongoDB 4.2 introduced support for read concerns and write stages.
91+
# Pre-4.2 servers may allow a "local" read concern anyway, but some
92+
# drivers may avoid inheriting a client-level read concern for pre-4.2.
93+
- minServerVersion: "4.2"
94+
maxServerVersion: "4.4.99"
9195
serverless: "forbid"
9296
operations:
9397
- object: *collection0

source/crud/tests/unified/db-aggregate-write-readPreference.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
"description": "Database-level aggregate with $out omits read preference for pre-5.0 server",
159159
"runOnRequirements": [
160160
{
161+
"minServerVersion": "4.2",
161162
"maxServerVersion": "4.4.99",
162163
"serverless": "forbid"
163164
}

source/crud/tests/unified/db-aggregate-write-readPreference.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ tests:
8181

8282
- description: "Database-level aggregate with $out omits read preference for pre-5.0 server"
8383
runOnRequirements:
84-
- maxServerVersion: "4.4.99"
84+
# MongoDB 4.2 introduced support for read concerns and write stages.
85+
# Pre-4.2 servers may allow a "local" read concern anyway, but some
86+
# drivers may avoid inheriting a client-level read concern for pre-4.2.
87+
- minServerVersion: "4.2"
88+
maxServerVersion: "4.4.99"
8589
serverless: "forbid"
8690
operations:
8791
- object: *database0

0 commit comments

Comments
 (0)