Skip to content

Commit

Permalink
TBD: Sync spec tests for DRIVERS-2385 prototyping
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Oct 7, 2022
1 parent b114c16 commit 0d93f11
Show file tree
Hide file tree
Showing 5 changed files with 603 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"description": "modifyCollection-errorResponse",
"schemaVersion": "1.12",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "collMod-tests"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "test"
}
}
],
"initialData": [
{
"collectionName": "test",
"databaseName": "collMod-tests",
"documents": [
{
"_id": 1,
"x": 1
},
{
"_id": 2,
"x": 1
}
]
}
],
"tests": [
{
"description": "modifyCollection prepareUnique violations are accessible",
"runOnRequirements": [
{
"minServerVersion": "5.2"
}
],
"operations": [
{
"name": "createIndex",
"object": "collection0",
"arguments": {
"keys": {
"x": 1
}
}
},
{
"name": "modifyCollection",
"object": "database0",
"arguments": {
"collection": "test",
"index": {
"keyPattern": {
"x": 1
},
"prepareUnique": true
}
}
},
{
"name": "insertOne",
"object": "collection0",
"arguments": {
"document": {
"_id": 3,
"x": 1
}
},
"expectError": {
"errorCode": 11000
}
},
{
"name": "modifyCollection",
"object": "database0",
"arguments": {
"collection": "test",
"index": {
"keyPattern": {
"x": 1
},
"unique": true
}
},
"expectError": {
"isClientError": false,
"errorCode": 359,
"errorResponse": {
"violations": [
{
"ids": [
1,
2
]
}
]
}
}
}
]
}
]
}
86 changes: 86 additions & 0 deletions tests/UnifiedSpecTests/crud/aggregate-merge-errorResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"description": "aggregate-merge-errorResponse",
"schemaVersion": "1.12",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-tests"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "test"
}
}
],
"initialData": [
{
"collectionName": "test",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1,
"x": 1
},
{
"_id": 2,
"x": 1
}
]
}
],
"tests": [
{
"description": "aggregate $merge DuplicateKey error is accessible",
"runOnRequirements": [
{
"minServerVersion": "4.2"
}
],
"operations": [
{
"name": "aggregate",
"object": "database0",
"arguments": {
"pipeline": [
{
"$documents": [
{
"_id": 2,
"x": 1
}
]
},
{
"$merge": {
"into": "test",
"whenMatched": "fail"
}
}
]
},
"expectError": {
"errorCode": 11000,
"errorResponse": {
"keyPattern": {
"_id": 1
},
"keyValue": {
"_id": 2
}
}
}
}
]
}
]
}
12 changes: 10 additions & 2 deletions tests/UnifiedSpecTests/crud/distinct-comment.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
"key": "value"
}
},
"expectResult": [ 11, 22, 33 ]
"expectResult": [
11,
22,
33
]
}
],
"expectEvents": [
Expand Down Expand Up @@ -105,7 +109,11 @@
"filter": {},
"comment": "comment"
},
"expectResult": [ 11, 22, 33 ]
"expectResult": [
11,
22,
33
]
}
],
"expectEvents": [
Expand Down
132 changes: 132 additions & 0 deletions tests/UnifiedSpecTests/crud/findOneAndUpdate-errorResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"description": "findOneAndUpdate-errorResponse",
"schemaVersion": "1.12",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-tests"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "test"
}
}
],
"initialData": [
{
"collectionName": "test",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1,
"x": "foo"
}
]
}
],
"tests": [
{
"description": "findOneAndUpdate DuplicateKey error is accessible",
"runOnRequirements": [
{
"minServerVersion": "4.2"
}
],
"operations": [
{
"name": "createIndex",
"object": "collection0",
"arguments": {
"keys": {
"x": 1
},
"unique": true
}
},
{
"name": "findOneAndUpdate",
"object": "collection0",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$set": {
"x": "foo"
}
},
"upsert": true
},
"expectError": {
"errorCode": 11000,
"errorResponse": {
"keyPattern": {
"x": 1
},
"keyValue": {
"x": "foo"
}
}
}
}
]
},
{
"description": "findOneAndUpdate document validation errInfo is accessible",
"runOnRequirements": [
{
"minServerVersion": "5.0"
}
],
"operations": [
{
"name": "modifyCollection",
"object": "database0",
"arguments": {
"collection": "test",
"validator": {
"x": {
"$type": "string"
}
}
}
},
{
"name": "findOneAndUpdate",
"object": "collection0",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$set": {
"x": 1
}
}
},
"expectError": {
"errorCode": 121,
"errorResponse": {
"errInfo": {
"failingDocumentId": 1,
"details": {
"$$type": "object"
}
}
}
}
}
]
}
]
}
Loading

0 comments on commit 0d93f11

Please sign in to comment.