Skip to content

Commit 2843e66

Browse files
committed
PYTHON-4919 Resync tests for retryable writes
1 parent 35b2fbb commit 2843e66

14 files changed

+703
-14
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"description": "aggregate with $out/$merge does not set txnNumber",
3+
"schemaVersion": "1.3",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "3.6",
7+
"topologies": [
8+
"replicaset",
9+
"sharded",
10+
"load-balanced"
11+
]
12+
}
13+
],
14+
"createEntities": [
15+
{
16+
"client": {
17+
"id": "client0",
18+
"observeEvents": [
19+
"commandStartedEvent"
20+
]
21+
}
22+
},
23+
{
24+
"database": {
25+
"id": "database0",
26+
"client": "client0",
27+
"databaseName": "retryable-writes-tests"
28+
}
29+
},
30+
{
31+
"collection": {
32+
"id": "collection0",
33+
"database": "database0",
34+
"collectionName": "coll0"
35+
}
36+
}
37+
],
38+
"initialData": [
39+
{
40+
"collectionName": "mergeCollection",
41+
"databaseName": "retryable-writes-tests",
42+
"documents": []
43+
}
44+
],
45+
"tests": [
46+
{
47+
"description": "aggregate with $out does not set txnNumber",
48+
"operations": [
49+
{
50+
"object": "collection0",
51+
"name": "aggregate",
52+
"arguments": {
53+
"pipeline": [
54+
{
55+
"$sort": {
56+
"x": 1
57+
}
58+
},
59+
{
60+
"$match": {
61+
"_id": {
62+
"$gt": 1
63+
}
64+
}
65+
},
66+
{
67+
"$out": "outCollection"
68+
}
69+
]
70+
}
71+
}
72+
],
73+
"expectEvents": [
74+
{
75+
"client": "client0",
76+
"events": [
77+
{
78+
"commandStartedEvent": {
79+
"commandName": "aggregate",
80+
"command": {
81+
"txnNumber": {
82+
"$$exists": false
83+
}
84+
}
85+
}
86+
}
87+
]
88+
}
89+
]
90+
},
91+
{
92+
"description": "aggregate with $merge does not set txnNumber",
93+
"runOnRequirements": [
94+
{
95+
"minServerVersion": "4.1.11"
96+
}
97+
],
98+
"operations": [
99+
{
100+
"object": "collection0",
101+
"name": "aggregate",
102+
"arguments": {
103+
"pipeline": [
104+
{
105+
"$sort": {
106+
"x": 1
107+
}
108+
},
109+
{
110+
"$match": {
111+
"_id": {
112+
"$gt": 1
113+
}
114+
}
115+
},
116+
{
117+
"$merge": {
118+
"into": "mergeCollection"
119+
}
120+
}
121+
]
122+
}
123+
}
124+
],
125+
"expectEvents": [
126+
{
127+
"client": "client0",
128+
"events": [
129+
{
130+
"commandStartedEvent": {
131+
"commandName": "aggregate",
132+
"command": {
133+
"txnNumber": {
134+
"$$exists": false
135+
}
136+
}
137+
}
138+
}
139+
]
140+
}
141+
]
142+
}
143+
]
144+
}

test/retryable_writes/unified/bulkWrite.json

Lines changed: 153 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
{
1414
"client": {
1515
"id": "client0",
16-
"useMultipleMongoses": false
16+
"useMultipleMongoses": false,
17+
"observeEvents": [
18+
"commandStartedEvent"
19+
]
1720
}
1821
},
1922
{
@@ -121,6 +124,53 @@
121124
}
122125
]
123126
}
127+
],
128+
"expectEvents": [
129+
{
130+
"client": "client0",
131+
"events": [
132+
{
133+
"commandStartedEvent": {
134+
"commandName": "insert",
135+
"command": {
136+
"txnNumber": {
137+
"$$exists": true
138+
}
139+
}
140+
}
141+
},
142+
{
143+
"commandStartedEvent": {
144+
"commandName": "insert",
145+
"command": {
146+
"txnNumber": {
147+
"$$exists": true
148+
}
149+
}
150+
}
151+
},
152+
{
153+
"commandStartedEvent": {
154+
"commandName": "update",
155+
"command": {
156+
"txnNumber": {
157+
"$$exists": true
158+
}
159+
}
160+
}
161+
},
162+
{
163+
"commandStartedEvent": {
164+
"commandName": "delete",
165+
"command": {
166+
"txnNumber": {
167+
"$$exists": true
168+
}
169+
}
170+
}
171+
}
172+
]
173+
}
124174
]
125175
},
126176
{
@@ -510,6 +560,33 @@
510560
}
511561
]
512562
}
563+
],
564+
"expectEvents": [
565+
{
566+
"client": "client0",
567+
"events": [
568+
{
569+
"commandStartedEvent": {
570+
"commandName": "insert",
571+
"command": {
572+
"txnNumber": {
573+
"$$exists": true
574+
}
575+
}
576+
}
577+
},
578+
{
579+
"commandStartedEvent": {
580+
"commandName": "insert",
581+
"command": {
582+
"txnNumber": {
583+
"$$exists": true
584+
}
585+
}
586+
}
587+
}
588+
]
589+
}
513590
]
514591
},
515592
{
@@ -926,6 +1003,81 @@
9261003
]
9271004
}
9281005
]
1006+
},
1007+
{
1008+
"description": "collection bulkWrite with updateMany does not set txnNumber",
1009+
"operations": [
1010+
{
1011+
"object": "collection0",
1012+
"name": "bulkWrite",
1013+
"arguments": {
1014+
"requests": [
1015+
{
1016+
"updateMany": {
1017+
"filter": {},
1018+
"update": {
1019+
"$set": {
1020+
"x": 1
1021+
}
1022+
}
1023+
}
1024+
}
1025+
]
1026+
}
1027+
}
1028+
],
1029+
"expectEvents": [
1030+
{
1031+
"client": "client0",
1032+
"events": [
1033+
{
1034+
"commandStartedEvent": {
1035+
"commandName": "update",
1036+
"command": {
1037+
"txnNumber": {
1038+
"$$exists": false
1039+
}
1040+
}
1041+
}
1042+
}
1043+
]
1044+
}
1045+
]
1046+
},
1047+
{
1048+
"description": "collection bulkWrite with deleteMany does not set txnNumber",
1049+
"operations": [
1050+
{
1051+
"object": "collection0",
1052+
"name": "bulkWrite",
1053+
"arguments": {
1054+
"requests": [
1055+
{
1056+
"deleteMany": {
1057+
"filter": {}
1058+
}
1059+
}
1060+
]
1061+
}
1062+
}
1063+
],
1064+
"expectEvents": [
1065+
{
1066+
"client": "client0",
1067+
"events": [
1068+
{
1069+
"commandStartedEvent": {
1070+
"commandName": "delete",
1071+
"command": {
1072+
"txnNumber": {
1073+
"$$exists": false
1074+
}
1075+
}
1076+
}
1077+
}
1078+
]
1079+
}
1080+
]
9291081
}
9301082
]
9311083
}

test/retryable_writes/unified/client-bulkWrite-serverErrors.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,10 @@
428428
{
429429
"ns": "retryable-writes-tests.coll0"
430430
}
431-
]
431+
],
432+
"txnNumber": {
433+
"$$exists": false
434+
}
432435
}
433436
}
434437
}
@@ -779,7 +782,10 @@
779782
{
780783
"ns": "retryable-writes-tests.coll0"
781784
}
782-
]
785+
],
786+
"txnNumber": {
787+
"$$exists": false
788+
}
783789
}
784790
}
785791
}
@@ -861,7 +867,10 @@
861867
{
862868
"ns": "retryable-writes-tests.coll0"
863869
}
864-
]
870+
],
871+
"txnNumber": {
872+
"$$exists": false
873+
}
865874
}
866875
}
867876
}

test/retryable_writes/unified/deleteMany.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
{
1616
"client": {
1717
"id": "client0",
18-
"useMultipleMongoses": true
18+
"useMultipleMongoses": true,
19+
"observeEvents": [
20+
"commandStartedEvent"
21+
]
1922
}
2023
},
2124
{
@@ -70,6 +73,23 @@
7073
"databaseName": "retryable-writes-tests",
7174
"documents": []
7275
}
76+
],
77+
"expectEvents": [
78+
{
79+
"client": "client0",
80+
"events": [
81+
{
82+
"commandStartedEvent": {
83+
"commandName": "delete",
84+
"command": {
85+
"txnNumber": {
86+
"$$exists": false
87+
}
88+
}
89+
}
90+
}
91+
]
92+
}
7393
]
7494
}
7595
]

0 commit comments

Comments
 (0)