Skip to content

Commit f15e9bd

Browse files
committed
CSHARP-5695: CSOT: Unified test spec runner
1 parent 34b020c commit f15e9bd

File tree

75 files changed

+55793
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+55793
-165
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{
2+
"description": "timeoutMS behaves correctly for bulkWrite operations",
3+
"schemaVersion": "1.9",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.4"
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "failPointClient",
13+
"useMultipleMongoses": false
14+
}
15+
},
16+
{
17+
"client": {
18+
"id": "client",
19+
"useMultipleMongoses": false,
20+
"observeEvents": [
21+
"commandStartedEvent"
22+
],
23+
"uriOptions": {
24+
"w": 1
25+
}
26+
}
27+
},
28+
{
29+
"database": {
30+
"id": "database",
31+
"client": "client",
32+
"databaseName": "test"
33+
}
34+
},
35+
{
36+
"collection": {
37+
"id": "collection",
38+
"database": "database",
39+
"collectionName": "coll"
40+
}
41+
}
42+
],
43+
"initialData": [
44+
{
45+
"collectionName": "coll",
46+
"databaseName": "test",
47+
"documents": []
48+
}
49+
],
50+
"tests": [
51+
{
52+
"description": "timeoutMS applied to entire bulkWrite, not individual commands",
53+
"operations": [
54+
{
55+
"name": "insertOne",
56+
"object": "collection",
57+
"arguments": {
58+
"document": {}
59+
}
60+
},
61+
{
62+
"name": "failPoint",
63+
"object": "testRunner",
64+
"arguments": {
65+
"client": "failPointClient",
66+
"failPoint": {
67+
"configureFailPoint": "failCommand",
68+
"mode": {
69+
"times": 2
70+
},
71+
"data": {
72+
"failCommands": [
73+
"insert",
74+
"update"
75+
],
76+
"blockConnection": true,
77+
"blockTimeMS": 120
78+
}
79+
}
80+
}
81+
},
82+
{
83+
"name": "bulkWrite",
84+
"object": "collection",
85+
"arguments": {
86+
"requests": [
87+
{
88+
"insertOne": {
89+
"document": {
90+
"_id": 1
91+
}
92+
}
93+
},
94+
{
95+
"replaceOne": {
96+
"filter": {
97+
"_id": 1
98+
},
99+
"replacement": {
100+
"x": 1
101+
}
102+
}
103+
}
104+
],
105+
"timeoutMS": 200
106+
},
107+
"expectError": {
108+
"isTimeoutError": true
109+
}
110+
}
111+
],
112+
"expectEvents": [
113+
{
114+
"client": "client",
115+
"events": [
116+
{
117+
"commandStartedEvent": {
118+
"commandName": "insert",
119+
"databaseName": "test",
120+
"command": {
121+
"insert": "coll"
122+
}
123+
}
124+
},
125+
{
126+
"commandStartedEvent": {
127+
"commandName": "insert",
128+
"databaseName": "test",
129+
"command": {
130+
"insert": "coll",
131+
"maxTimeMS": {
132+
"$$type": [
133+
"int",
134+
"long"
135+
]
136+
}
137+
}
138+
}
139+
},
140+
{
141+
"commandStartedEvent": {
142+
"commandName": "update",
143+
"databaseName": "test",
144+
"command": {
145+
"update": "coll",
146+
"maxTimeMS": {
147+
"$$type": [
148+
"int",
149+
"long"
150+
]
151+
}
152+
}
153+
}
154+
}
155+
]
156+
}
157+
]
158+
}
159+
]
160+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
description: "timeoutMS behaves correctly for bulkWrite operations"
2+
3+
schemaVersion: "1.9"
4+
5+
runOnRequirements:
6+
- minServerVersion: "4.4"
7+
8+
createEntities:
9+
- client:
10+
id: &failPointClient failPointClient
11+
useMultipleMongoses: false
12+
- client:
13+
id: &client client
14+
useMultipleMongoses: false
15+
observeEvents:
16+
- commandStartedEvent
17+
uriOptions:
18+
# Used to speed up the test
19+
w: 1
20+
- database:
21+
id: &database database
22+
client: *client
23+
databaseName: &databaseName test
24+
- collection:
25+
id: &collection collection
26+
database: *database
27+
collectionName: &collectionName coll
28+
29+
initialData:
30+
- collectionName: *collectionName
31+
databaseName: *databaseName
32+
documents: []
33+
34+
tests:
35+
# Test that drivers do not refresh timeoutMS between commands. This is done by running a bulkWrite that will require
36+
# two commands with timeoutMS=200 and blocking each command for 120ms. The server should take over 200ms total, so the
37+
# bulkWrite should fail with a timeout error.
38+
- description: "timeoutMS applied to entire bulkWrite, not individual commands"
39+
operations:
40+
# Do an operation without a timeout to ensure the servers are discovered.
41+
- name: insertOne
42+
object: *collection
43+
arguments:
44+
document: {}
45+
- name: failPoint
46+
object: testRunner
47+
arguments:
48+
client: *failPointClient
49+
failPoint:
50+
configureFailPoint: failCommand
51+
mode: { times: 2 }
52+
data:
53+
failCommands: ["insert", "update"]
54+
blockConnection: true
55+
blockTimeMS: 120
56+
- name: bulkWrite
57+
object: *collection
58+
arguments:
59+
requests:
60+
- insertOne:
61+
document: { _id: 1 }
62+
- replaceOne:
63+
filter: { _id: 1 }
64+
replacement: { x: 1 }
65+
timeoutMS: 200
66+
expectError:
67+
isTimeoutError: true
68+
expectEvents:
69+
- client: *client
70+
events:
71+
- commandStartedEvent:
72+
commandName: insert
73+
databaseName: *databaseName
74+
command:
75+
insert: *collectionName
76+
- commandStartedEvent:
77+
commandName: insert
78+
databaseName: *databaseName
79+
command:
80+
insert: *collectionName
81+
maxTimeMS: { $$type: ["int", "long"] }
82+
- commandStartedEvent:
83+
commandName: update
84+
databaseName: *databaseName
85+
command:
86+
update: *collectionName
87+
maxTimeMS: { $$type: ["int", "long"] }

0 commit comments

Comments
 (0)