Skip to content

Commit

Permalink
Resync CRUD tests to use transactions test format (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
Divjot Arora committed Jul 29, 2020
1 parent 7872942 commit ff5ea94
Show file tree
Hide file tree
Showing 46 changed files with 1,921 additions and 167 deletions.
338 changes: 290 additions & 48 deletions data/crud/README.rst

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions data/crud/v1/read/aggregate-out.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
}
},
"outcome": {
"result": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection": {
"name": "other_test_collection",
"data": [
Expand Down Expand Up @@ -92,16 +82,6 @@
}
},
"outcome": {
"result": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"collection": {
"name": "other_test_collection",
"data": [
Expand Down
6 changes: 0 additions & 6 deletions data/crud/v1/read/aggregate-out.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ tests:
batchSize: 2

outcome:
result:
- {_id: 2, x: 22}
- {_id: 3, x: 33}
collection:
name: "other_test_collection"
data:
Expand All @@ -39,9 +36,6 @@ tests:
batchSize: 0

outcome:
result:
- {_id: 2, x: 22}
- {_id: 3, x: 33}
collection:
name: "other_test_collection"
data:
Expand Down
20 changes: 19 additions & 1 deletion data/crud/v1/read/count-collation.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@
"minServerVersion": "3.4",
"tests": [
{
"description": "Count with collation",
"description": "Count documents with collation",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {
"x": "ping"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": 1
}
},
{
"description": "Deprecated count with collation",
"operation": {
"name": "count",
"arguments": {
Expand Down
14 changes: 12 additions & 2 deletions data/crud/v1/read/count-collation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@ minServerVersion: '3.4'

tests:
-
description: "Count with collation"
description: "Count documents with collation"
operation:
name: count
name: countDocuments
arguments:
filter: { x: 'ping' }
collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document

outcome:
result: 1
-
description: "Deprecated count with collation"
operation:
name: count
arguments:
filter: { x: 'ping' }
collation: { locale: 'en_US', strength: 2 }

outcome:
result: 1
39 changes: 39 additions & 0 deletions data/crud/v1/read/count-empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"data": [],
"tests": [
{
"description": "Estimated document count with empty collection",
"operation": {
"name": "estimatedDocumentCount",
"arguments": {}
},
"outcome": {
"result": 0
}
},
{
"description": "Count documents with empty collection",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 0
}
},
{
"description": "Deprecated count with empty collection",
"operation": {
"name": "count",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 0
}
}
]
}
29 changes: 29 additions & 0 deletions data/crud/v1/read/count-empty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
data: []

tests:
-
description: "Estimated document count with empty collection"
operation:
name: estimatedDocumentCount
arguments: { }

outcome:
result: 0
-
description: "Count documents with empty collection"
operation:
name: countDocuments
arguments:
filter: { }

outcome:
result: 0
-
description: "Deprecated count with empty collection"
operation:
name: count
arguments:
filter: { }

outcome:
result: 0
58 changes: 55 additions & 3 deletions data/crud/v1/read/count.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,59 @@
],
"tests": [
{
"description": "Count without a filter",
"description": "Estimated document count",
"operation": {
"name": "estimatedDocumentCount",
"arguments": {}
},
"outcome": {
"result": 3
}
},
{
"description": "Count documents without a filter",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 3
}
},
{
"description": "Count documents with a filter",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
}
},
"outcome": {
"result": 2
}
},
{
"description": "Count documents with skip and limit",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {},
"skip": 1,
"limit": 3
}
},
"outcome": {
"result": 2
}
},
{
"description": "Deprecated count without a filter",
"operation": {
"name": "count",
"arguments": {
Expand All @@ -27,7 +79,7 @@
}
},
{
"description": "Count with a filter",
"description": "Deprecated count with a filter",
"operation": {
"name": "count",
"arguments": {
Expand All @@ -43,7 +95,7 @@
}
},
{
"description": "Count with skip and limit",
"description": "Deprecated count with skip and limit",
"operation": {
"name": "count",
"arguments": {
Expand Down
48 changes: 43 additions & 5 deletions data/crud/v1/read/count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,45 @@ data:

tests:
-
description: "Count without a filter"
description: "Estimated document count"
operation:
name: estimatedDocumentCount
arguments: { }

outcome:
result: 3
-
description: "Count documents without a filter"
operation:
name: countDocuments
arguments:
filter: { }

outcome:
result: 3
-
description: "Count documents with a filter"
operation:
name: countDocuments
arguments:
filter:
_id: {$gt: 1}

outcome:
result: 2
-
description: "Count documents with skip and limit"
operation:
name: countDocuments
arguments:
filter: {}
skip: 1
limit: 3

outcome:
result: 2
-
description: "Deprecated count without a filter"
operation:
name: count
arguments:
Expand All @@ -14,17 +52,17 @@ tests:
outcome:
result: 3
-
description: "Count with a filter"
description: "Deprecated count with a filter"
operation:
name: count
arguments:
filter:
filter:
_id: {$gt: 1}

outcome:
result: 2
-
description: "Count with skip and limit"
description: "Deprecated count with skip and limit"
operation:
name: count
arguments:
Expand All @@ -33,4 +71,4 @@ tests:
limit: 3

outcome:
result: 2
result: 2
Loading

0 comments on commit ff5ea94

Please sign in to comment.