Skip to content

Commit 9ad5dd6

Browse files
authored
CSHARP-4303: Exclude create events from change stream events when testing showExpandedEvents (#886)
1 parent 2873762 commit 9ad5dd6

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

tests/MongoDB.Driver.Tests/Specifications/change-streams/tests/unified/change-streams-showExpandedEvents.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"replicaset",
99
"sharded-replicaset",
1010
"sharded"
11-
]
11+
],
12+
"serverless": "forbid"
1213
}
1314
],
1415
"createEntities": [
@@ -275,7 +276,15 @@
275276
"name": "createChangeStream",
276277
"object": "collection0",
277278
"arguments": {
278-
"pipeline": [],
279+
"pipeline": [
280+
{
281+
"$match": {
282+
"operationType": {
283+
"$ne": "create"
284+
}
285+
}
286+
}
287+
],
279288
"showExpandedEvents": true
280289
},
281290
"saveResultAsEntity": "changeStream0"

tests/MongoDB.Driver.Tests/Specifications/change-streams/tests/unified/change-streams-showExpandedEvents.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ schemaVersion: "1.7"
33
runOnRequirements:
44
- minServerVersion: "6.0.0"
55
topologies: [ replicaset, sharded-replicaset, sharded ]
6+
serverless: forbid
67
createEntities:
78
- client:
89
id: &client0 client0
@@ -160,7 +161,15 @@ tests:
160161
- name: createChangeStream
161162
object: *collection0
162163
arguments:
163-
pipeline: []
164+
pipeline:
165+
# On sharded clusters, the create command run when loading initial
166+
# data sometimes is still reported in the change stream. To avoid
167+
# this, we exclude the create command when creating the change
168+
# stream, but specifically don't exclude other events to still catch
169+
# driver errors.
170+
- $match:
171+
operationType:
172+
$ne: create
164173
showExpandedEvents: true
165174
saveResultAsEntity: &changeStream0 changeStream0
166175
- name: createIndex

0 commit comments

Comments
 (0)