Skip to content

Commit 12e951b

Browse files
test(NODE-4605, NODE-4597, NODE-4618): sync latest change stream unified tests (#3402)
1 parent 085471d commit 12e951b

6 files changed

+144
-5
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"description": "change-streams-clusterTime",
3+
"schemaVersion": "1.3",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false
9+
}
10+
},
11+
{
12+
"database": {
13+
"id": "database0",
14+
"client": "client0",
15+
"databaseName": "database0"
16+
}
17+
},
18+
{
19+
"collection": {
20+
"id": "collection0",
21+
"database": "database0",
22+
"collectionName": "collection0"
23+
}
24+
}
25+
],
26+
"runOnRequirements": [
27+
{
28+
"minServerVersion": "4.0.0",
29+
"topologies": [
30+
"replicaset",
31+
"sharded-replicaset",
32+
"load-balanced",
33+
"sharded"
34+
]
35+
}
36+
],
37+
"initialData": [
38+
{
39+
"collectionName": "collection0",
40+
"databaseName": "database0",
41+
"documents": []
42+
}
43+
],
44+
"tests": [
45+
{
46+
"description": "clusterTime is present",
47+
"operations": [
48+
{
49+
"name": "createChangeStream",
50+
"object": "collection0",
51+
"arguments": {
52+
"pipeline": []
53+
},
54+
"saveResultAsEntity": "changeStream0"
55+
},
56+
{
57+
"name": "insertOne",
58+
"object": "collection0",
59+
"arguments": {
60+
"document": {
61+
"_id": 1
62+
}
63+
}
64+
},
65+
{
66+
"name": "iterateUntilDocumentOrError",
67+
"object": "changeStream0",
68+
"expectResult": {
69+
"ns": {
70+
"db": "database0",
71+
"coll": "collection0"
72+
},
73+
"clusterTime": {
74+
"$$exists": true
75+
}
76+
}
77+
}
78+
]
79+
}
80+
]
81+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
description: "change-streams-clusterTime"
2+
schemaVersion: "1.3"
3+
createEntities:
4+
- client:
5+
id: &client0 client0
6+
useMultipleMongoses: false
7+
- database:
8+
id: &database0 database0
9+
client: *client0
10+
databaseName: *database0
11+
- collection:
12+
id: &collection0 collection0
13+
database: *database0
14+
collectionName: *collection0
15+
16+
runOnRequirements:
17+
- minServerVersion: "4.0.0"
18+
topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ]
19+
20+
initialData:
21+
- collectionName: *collection0
22+
databaseName: *database0
23+
documents: []
24+
25+
tests:
26+
- description: "clusterTime is present"
27+
operations:
28+
- name: createChangeStream
29+
object: *collection0
30+
arguments: { pipeline: [] }
31+
saveResultAsEntity: &changeStream0 changeStream0
32+
- name: insertOne
33+
object: *collection0
34+
arguments:
35+
document: { _id: 1 }
36+
- name: iterateUntilDocumentOrError
37+
object: *changeStream0
38+
expectResult:
39+
ns: { db: *database0, coll: *collection0 }
40+
clusterTime: { $$exists: true }

test/spec/change-streams/unified/change-streams-disambiguatedPaths.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"description": "disambiguatedPaths",
3-
"schemaVersion": "1.3",
3+
"schemaVersion": "1.4",
44
"createEntities": [
55
{
66
"client": {
@@ -31,7 +31,8 @@
3131
"sharded-replicaset",
3232
"load-balanced",
3333
"sharded"
34-
]
34+
],
35+
"serverless": "forbid"
3536
}
3637
],
3738
"initialData": [

test/spec/change-streams/unified/change-streams-disambiguatedPaths.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
description: "disambiguatedPaths"
2-
schemaVersion: "1.3"
2+
schemaVersion: "1.4"
33
createEntities:
44
- client:
55
id: &client0 client0
@@ -16,6 +16,7 @@ createEntities:
1616
runOnRequirements:
1717
- minServerVersion: "6.1.0"
1818
topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ]
19+
serverless: forbid
1920

2021
initialData:
2122
- collectionName: *collection0

test/spec/change-streams/unified/change-streams-showExpandedEvents.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,15 @@
275275
"name": "createChangeStream",
276276
"object": "collection0",
277277
"arguments": {
278-
"pipeline": [],
278+
"pipeline": [
279+
{
280+
"$match": {
281+
"operationType": {
282+
"$ne": "create"
283+
}
284+
}
285+
}
286+
],
279287
"showExpandedEvents": true
280288
},
281289
"saveResultAsEntity": "changeStream0"

test/spec/change-streams/unified/change-streams-showExpandedEvents.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,15 @@ tests:
160160
- name: createChangeStream
161161
object: *collection0
162162
arguments:
163-
pipeline: []
163+
pipeline:
164+
# On sharded clusters, the create command run when loading initial
165+
# data sometimes is still reported in the change stream. To avoid
166+
# this, we exclude the create command when creating the change
167+
# stream, but specifically don't exclude other events to still catch
168+
# driver errors.
169+
- $match:
170+
operationType:
171+
$ne: create
164172
showExpandedEvents: true
165173
saveResultAsEntity: &changeStream0 changeStream0
166174
- name: createIndex

0 commit comments

Comments
 (0)