Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions specifications/client-side-operations-timeout/tests/bulkWrite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"description": "timeoutMS behaves correctly for bulkWrite operations",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"createEntities": [
{
"client": {
"id": "failPointClient",
"useMultipleMongoses": false
}
},
{
"client": {
"id": "client",
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent"
],
"uriOptions": {
"w": 1
}
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "test",
"documents": []
}
],
"tests": [
{
"description": "timeoutMS applied to entire bulkWrite, not individual commands",
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"document": {}
}
},
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"insert",
"update"
],
"blockConnection": true,
"blockTimeMS": 120
}
}
}
},
{
"name": "bulkWrite",
"object": "collection",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"_id": 1
}
}
},
{
"replaceOne": {
"filter": {
"_id": 1
},
"replacement": {
"x": 1
}
}
}
],
"timeoutMS": 200
},
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll"
}
}
},
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll",
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandStartedEvent": {
"commandName": "update",
"databaseName": "test",
"command": {
"update": "coll",
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
description: "timeoutMS behaves correctly for bulkWrite operations"

schemaVersion: "1.9"

runOnRequirements:
- minServerVersion: "4.4"

createEntities:
- client:
id: &failPointClient failPointClient
useMultipleMongoses: false
- client:
id: &client client
useMultipleMongoses: false
observeEvents:
- commandStartedEvent
uriOptions:
# Used to speed up the test
w: 1
- database:
id: &database database
client: *client
databaseName: &databaseName test
- collection:
id: &collection collection
database: *database
collectionName: &collectionName coll

initialData:
- collectionName: *collectionName
databaseName: *databaseName
documents: []

tests:
# Test that drivers do not refresh timeoutMS between commands. This is done by running a bulkWrite that will require
# two commands with timeoutMS=200 and blocking each command for 120ms. The server should take over 200ms total, so the
# bulkWrite should fail with a timeout error.
- description: "timeoutMS applied to entire bulkWrite, not individual commands"
operations:
# Do an operation without a timeout to ensure the servers are discovered.
- name: insertOne
object: *collection
arguments:
document: {}
- name: failPoint
object: testRunner
arguments:
client: *failPointClient
failPoint:
configureFailPoint: failCommand
mode: { times: 2 }
data:
failCommands: ["insert", "update"]
blockConnection: true
blockTimeMS: 120
- name: bulkWrite
object: *collection
arguments:
requests:
- insertOne:
document: { _id: 1 }
- replaceOne:
filter: { _id: 1 }
replacement: { x: 1 }
timeoutMS: 200
expectError:
isTimeoutError: true
expectEvents:
- client: *client
events:
- commandStartedEvent:
commandName: insert
databaseName: *databaseName
command:
insert: *collectionName
- commandStartedEvent:
commandName: insert
databaseName: *databaseName
command:
insert: *collectionName
maxTimeMS: { $$type: ["int", "long"] }
- commandStartedEvent:
commandName: update
databaseName: *databaseName
command:
update: *collectionName
maxTimeMS: { $$type: ["int", "long"] }
Loading