Skip to content

Commit 037df13

Browse files
author
Divjot Arora
authored
Resync CRUD tests to use transactions test format (#459)
GODRIVER-761 GODRIVER-1696
1 parent ec90045 commit 037df13

Some content is hidden

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

46 files changed

+1921
-167
lines changed

data/crud/README.rst

Lines changed: 290 additions & 48 deletions
Large diffs are not rendered by default.

data/crud/v1/read/aggregate-out.json

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@
4141
}
4242
},
4343
"outcome": {
44-
"result": [
45-
{
46-
"_id": 2,
47-
"x": 22
48-
},
49-
{
50-
"_id": 3,
51-
"x": 33
52-
}
53-
],
5444
"collection": {
5545
"name": "other_test_collection",
5646
"data": [
@@ -92,16 +82,6 @@
9282
}
9383
},
9484
"outcome": {
95-
"result": [
96-
{
97-
"_id": 2,
98-
"x": 22
99-
},
100-
{
101-
"_id": 3,
102-
"x": 33
103-
}
104-
],
10585
"collection": {
10686
"name": "other_test_collection",
10787
"data": [

data/crud/v1/read/aggregate-out.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ tests:
1818
batchSize: 2
1919

2020
outcome:
21-
result:
22-
- {_id: 2, x: 22}
23-
- {_id: 3, x: 33}
2421
collection:
2522
name: "other_test_collection"
2623
data:
@@ -39,9 +36,6 @@ tests:
3936
batchSize: 0
4037

4138
outcome:
42-
result:
43-
- {_id: 2, x: 22}
44-
- {_id: 3, x: 33}
4539
collection:
4640
name: "other_test_collection"
4741
data:

data/crud/v1/read/count-collation.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@
88
"minServerVersion": "3.4",
99
"tests": [
1010
{
11-
"description": "Count with collation",
11+
"description": "Count documents with collation",
12+
"operation": {
13+
"name": "countDocuments",
14+
"arguments": {
15+
"filter": {
16+
"x": "ping"
17+
},
18+
"collation": {
19+
"locale": "en_US",
20+
"strength": 2
21+
}
22+
}
23+
},
24+
"outcome": {
25+
"result": 1
26+
}
27+
},
28+
{
29+
"description": "Deprecated count with collation",
1230
"operation": {
1331
"name": "count",
1432
"arguments": {

data/crud/v1/read/count-collation.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ minServerVersion: '3.4'
44

55
tests:
66
-
7-
description: "Count with collation"
7+
description: "Count documents with collation"
88
operation:
9-
name: count
9+
name: countDocuments
1010
arguments:
1111
filter: { x: 'ping' }
1212
collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document
1313

1414
outcome:
1515
result: 1
16+
-
17+
description: "Deprecated count with collation"
18+
operation:
19+
name: count
20+
arguments:
21+
filter: { x: 'ping' }
22+
collation: { locale: 'en_US', strength: 2 }
23+
24+
outcome:
25+
result: 1

data/crud/v1/read/count-empty.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"data": [],
3+
"tests": [
4+
{
5+
"description": "Estimated document count with empty collection",
6+
"operation": {
7+
"name": "estimatedDocumentCount",
8+
"arguments": {}
9+
},
10+
"outcome": {
11+
"result": 0
12+
}
13+
},
14+
{
15+
"description": "Count documents with empty collection",
16+
"operation": {
17+
"name": "countDocuments",
18+
"arguments": {
19+
"filter": {}
20+
}
21+
},
22+
"outcome": {
23+
"result": 0
24+
}
25+
},
26+
{
27+
"description": "Deprecated count with empty collection",
28+
"operation": {
29+
"name": "count",
30+
"arguments": {
31+
"filter": {}
32+
}
33+
},
34+
"outcome": {
35+
"result": 0
36+
}
37+
}
38+
]
39+
}

data/crud/v1/read/count-empty.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
data: []
2+
3+
tests:
4+
-
5+
description: "Estimated document count with empty collection"
6+
operation:
7+
name: estimatedDocumentCount
8+
arguments: { }
9+
10+
outcome:
11+
result: 0
12+
-
13+
description: "Count documents with empty collection"
14+
operation:
15+
name: countDocuments
16+
arguments:
17+
filter: { }
18+
19+
outcome:
20+
result: 0
21+
-
22+
description: "Deprecated count with empty collection"
23+
operation:
24+
name: count
25+
arguments:
26+
filter: { }
27+
28+
outcome:
29+
result: 0

data/crud/v1/read/count.json

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,59 @@
1515
],
1616
"tests": [
1717
{
18-
"description": "Count without a filter",
18+
"description": "Estimated document count",
19+
"operation": {
20+
"name": "estimatedDocumentCount",
21+
"arguments": {}
22+
},
23+
"outcome": {
24+
"result": 3
25+
}
26+
},
27+
{
28+
"description": "Count documents without a filter",
29+
"operation": {
30+
"name": "countDocuments",
31+
"arguments": {
32+
"filter": {}
33+
}
34+
},
35+
"outcome": {
36+
"result": 3
37+
}
38+
},
39+
{
40+
"description": "Count documents with a filter",
41+
"operation": {
42+
"name": "countDocuments",
43+
"arguments": {
44+
"filter": {
45+
"_id": {
46+
"$gt": 1
47+
}
48+
}
49+
}
50+
},
51+
"outcome": {
52+
"result": 2
53+
}
54+
},
55+
{
56+
"description": "Count documents with skip and limit",
57+
"operation": {
58+
"name": "countDocuments",
59+
"arguments": {
60+
"filter": {},
61+
"skip": 1,
62+
"limit": 3
63+
}
64+
},
65+
"outcome": {
66+
"result": 2
67+
}
68+
},
69+
{
70+
"description": "Deprecated count without a filter",
1971
"operation": {
2072
"name": "count",
2173
"arguments": {
@@ -27,7 +79,7 @@
2779
}
2880
},
2981
{
30-
"description": "Count with a filter",
82+
"description": "Deprecated count with a filter",
3183
"operation": {
3284
"name": "count",
3385
"arguments": {
@@ -43,7 +95,7 @@
4395
}
4496
},
4597
{
46-
"description": "Count with skip and limit",
98+
"description": "Deprecated count with skip and limit",
4799
"operation": {
48100
"name": "count",
49101
"arguments": {

data/crud/v1/read/count.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,45 @@ data:
55

66
tests:
77
-
8-
description: "Count without a filter"
8+
description: "Estimated document count"
9+
operation:
10+
name: estimatedDocumentCount
11+
arguments: { }
12+
13+
outcome:
14+
result: 3
15+
-
16+
description: "Count documents without a filter"
17+
operation:
18+
name: countDocuments
19+
arguments:
20+
filter: { }
21+
22+
outcome:
23+
result: 3
24+
-
25+
description: "Count documents with a filter"
26+
operation:
27+
name: countDocuments
28+
arguments:
29+
filter:
30+
_id: {$gt: 1}
31+
32+
outcome:
33+
result: 2
34+
-
35+
description: "Count documents with skip and limit"
36+
operation:
37+
name: countDocuments
38+
arguments:
39+
filter: {}
40+
skip: 1
41+
limit: 3
42+
43+
outcome:
44+
result: 2
45+
-
46+
description: "Deprecated count without a filter"
947
operation:
1048
name: count
1149
arguments:
@@ -14,17 +52,17 @@ tests:
1452
outcome:
1553
result: 3
1654
-
17-
description: "Count with a filter"
55+
description: "Deprecated count with a filter"
1856
operation:
1957
name: count
2058
arguments:
21-
filter:
59+
filter:
2260
_id: {$gt: 1}
2361

2462
outcome:
2563
result: 2
2664
-
27-
description: "Count with skip and limit"
65+
description: "Deprecated count with skip and limit"
2866
operation:
2967
name: count
3068
arguments:
@@ -33,4 +71,4 @@ tests:
3371
limit: 3
3472

3573
outcome:
36-
result: 2
74+
result: 2

0 commit comments

Comments
 (0)