-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional tests for expectedError.errorResponse
Adds basic tests for expectedError.errorResponse under the unified test format, which are derived from the operation-failure tests in valid-fail. Also adds tests for write operations (i.e. insert, update, delete, and bulkWrite), which may be problematic for some drivers that use special exceptions such as BulkWriteException, which may not provide direct access to a single response. Note that tests should avoid using errorResponse assertions for such operations and permit drivers to skip those tests as needed.
- Loading branch information
Showing
11 changed files
with
628 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"description": "bulkWrite-errorResponse", | ||
"schemaVersion": "1.12", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0" | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "crud-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "bulkWrite operations support errorResponse assertions", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "4.0.0", | ||
"topologies": [ | ||
"single", | ||
"replicaset" | ||
] | ||
}, | ||
{ | ||
"minServerVersion": "4.2.0", | ||
"topologies": [ | ||
"sharded" | ||
] | ||
} | ||
], | ||
"operations": [ | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"insert" | ||
], | ||
"errorCode": 8 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "bulkWrite", | ||
"object": "collection0", | ||
"arguments": { | ||
"requests": [ | ||
{ | ||
"insertOne": { | ||
"document": { | ||
"_id": 1 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"expectError": { | ||
"errorCode": 8, | ||
"errorResponse": { | ||
"code": 8 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
description: "bulkWrite-errorResponse" | ||
|
||
schemaVersion: "1.12" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &database0Name crud-tests | ||
- collection: | ||
id: &collection0 collection0 | ||
database: *database0 | ||
collectionName: &collection0Name test | ||
|
||
tests: | ||
- description: "bulkWrite operations support errorResponse assertions" | ||
runOnRequirements: | ||
- minServerVersion: "4.0.0" | ||
topologies: [ single, replicaset ] | ||
- minServerVersion: "4.2.0" | ||
topologies: [ sharded ] | ||
operations: | ||
- name: failPoint | ||
object: testRunner | ||
arguments: | ||
client: *client0 | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 1 } | ||
data: | ||
failCommands: [ insert ] | ||
errorCode: &errorCode 8 # UnknownError | ||
- name: bulkWrite | ||
object: *collection0 | ||
arguments: | ||
requests: | ||
- insertOne: | ||
document: { _id: 1 } | ||
expectError: | ||
errorCode: *errorCode | ||
errorResponse: | ||
code: *errorCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"description": "deleteOne-errorResponse", | ||
"schemaVersion": "1.12", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0" | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "crud-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "delete operations support errorResponse assertions", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "4.0.0", | ||
"topologies": [ | ||
"single", | ||
"replicaset" | ||
] | ||
}, | ||
{ | ||
"minServerVersion": "4.2.0", | ||
"topologies": [ | ||
"sharded" | ||
] | ||
} | ||
], | ||
"operations": [ | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"delete" | ||
], | ||
"errorCode": 8 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "deleteOne", | ||
"object": "collection0", | ||
"arguments": { | ||
"filter": { | ||
"_id": 1 | ||
} | ||
}, | ||
"expectError": { | ||
"errorCode": 8, | ||
"errorResponse": { | ||
"code": 8 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
description: "deleteOne-errorResponse" | ||
|
||
schemaVersion: "1.12" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &database0Name crud-tests | ||
- collection: | ||
id: &collection0 collection0 | ||
database: *database0 | ||
collectionName: &collection0Name test | ||
|
||
tests: | ||
- description: "delete operations support errorResponse assertions" | ||
runOnRequirements: | ||
- minServerVersion: "4.0.0" | ||
topologies: [ single, replicaset ] | ||
- minServerVersion: "4.2.0" | ||
topologies: [ sharded ] | ||
operations: | ||
- name: failPoint | ||
object: testRunner | ||
arguments: | ||
client: *client0 | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 1 } | ||
data: | ||
failCommands: [ delete ] | ||
errorCode: &errorCode 8 # UnknownError | ||
- name: deleteOne | ||
object: *collection0 | ||
arguments: | ||
filter: { _id: 1 } | ||
expectError: | ||
errorCode: *errorCode | ||
errorResponse: | ||
code: *errorCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"description": "insertOne-errorResponse", | ||
"schemaVersion": "1.12", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0" | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database0", | ||
"client": "client0", | ||
"databaseName": "crud-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection0", | ||
"database": "database0", | ||
"collectionName": "test" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "insert operations support errorResponse assertions", | ||
"runOnRequirements": [ | ||
{ | ||
"minServerVersion": "4.0.0", | ||
"topologies": [ | ||
"single", | ||
"replicaset" | ||
] | ||
}, | ||
{ | ||
"minServerVersion": "4.2.0", | ||
"topologies": [ | ||
"sharded" | ||
] | ||
} | ||
], | ||
"operations": [ | ||
{ | ||
"name": "failPoint", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"failPoint": { | ||
"configureFailPoint": "failCommand", | ||
"mode": { | ||
"times": 1 | ||
}, | ||
"data": { | ||
"failCommands": [ | ||
"insert" | ||
], | ||
"errorCode": 8 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "insertOne", | ||
"object": "collection0", | ||
"arguments": { | ||
"document": { | ||
"_id": 1 | ||
} | ||
}, | ||
"expectError": { | ||
"errorCode": 8, | ||
"errorResponse": { | ||
"code": 8 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
description: "insertOne-errorResponse" | ||
|
||
schemaVersion: "1.12" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
- database: | ||
id: &database0 database0 | ||
client: *client0 | ||
databaseName: &database0Name crud-tests | ||
- collection: | ||
id: &collection0 collection0 | ||
database: *database0 | ||
collectionName: &collection0Name test | ||
|
||
tests: | ||
- description: "insert operations support errorResponse assertions" | ||
runOnRequirements: | ||
- minServerVersion: "4.0.0" | ||
topologies: [ single, replicaset ] | ||
- minServerVersion: "4.2.0" | ||
topologies: [ sharded ] | ||
operations: | ||
- name: failPoint | ||
object: testRunner | ||
arguments: | ||
client: *client0 | ||
failPoint: | ||
configureFailPoint: failCommand | ||
mode: { times: 1 } | ||
data: | ||
failCommands: [ insert ] | ||
errorCode: &errorCode 8 # UnknownError | ||
- name: insertOne | ||
object: *collection0 | ||
arguments: | ||
document: { _id: 1 } | ||
expectError: | ||
errorCode: *errorCode | ||
errorResponse: | ||
code: *errorCode |
Oops, something went wrong.