Skip to content

Commit 53b7f16

Browse files
authored
DRIVERS-2265: Tests for aggregate allowDiskUse option (#1178)
1 parent bb7a784 commit 53b7f16

File tree

4 files changed

+234
-4
lines changed

4 files changed

+234
-4
lines changed
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{
2+
"description": "aggregate-allowdiskuse",
3+
"schemaVersion": "1.0",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent"
10+
]
11+
}
12+
},
13+
{
14+
"database": {
15+
"id": "database0",
16+
"client": "client0",
17+
"databaseName": "crud-tests"
18+
}
19+
},
20+
{
21+
"collection": {
22+
"id": "collection0",
23+
"database": "database0",
24+
"collectionName": "coll0"
25+
}
26+
}
27+
],
28+
"initialData": [
29+
{
30+
"collectionName": "coll0",
31+
"databaseName": "crud-tests",
32+
"documents": []
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "Aggregate does not send allowDiskUse when value is not specified",
38+
"operations": [
39+
{
40+
"object": "collection0",
41+
"name": "aggregate",
42+
"arguments": {
43+
"pipeline": [
44+
{
45+
"$match": {}
46+
}
47+
]
48+
}
49+
}
50+
],
51+
"expectEvents": [
52+
{
53+
"client": "client0",
54+
"events": [
55+
{
56+
"commandStartedEvent": {
57+
"command": {
58+
"aggregate": "coll0",
59+
"pipeline": [
60+
{
61+
"$match": {}
62+
}
63+
],
64+
"allowDiskUse": {
65+
"$$exists": false
66+
}
67+
},
68+
"commandName": "aggregate",
69+
"databaseName": "crud-tests"
70+
}
71+
}
72+
]
73+
}
74+
]
75+
},
76+
{
77+
"description": "Aggregate sends allowDiskUse false when false is specified",
78+
"operations": [
79+
{
80+
"object": "collection0",
81+
"name": "aggregate",
82+
"arguments": {
83+
"pipeline": [
84+
{
85+
"$match": {}
86+
}
87+
],
88+
"allowDiskUse": false
89+
}
90+
}
91+
],
92+
"expectEvents": [
93+
{
94+
"client": "client0",
95+
"events": [
96+
{
97+
"commandStartedEvent": {
98+
"command": {
99+
"aggregate": "coll0",
100+
"pipeline": [
101+
{
102+
"$match": {}
103+
}
104+
],
105+
"allowDiskUse": false
106+
},
107+
"commandName": "aggregate",
108+
"databaseName": "crud-tests"
109+
}
110+
}
111+
]
112+
}
113+
]
114+
},
115+
{
116+
"description": "Aggregate sends allowDiskUse true when true is specified",
117+
"operations": [
118+
{
119+
"object": "collection0",
120+
"name": "aggregate",
121+
"arguments": {
122+
"pipeline": [
123+
{
124+
"$match": {}
125+
}
126+
],
127+
"allowDiskUse": true
128+
}
129+
}
130+
],
131+
"expectEvents": [
132+
{
133+
"client": "client0",
134+
"events": [
135+
{
136+
"commandStartedEvent": {
137+
"command": {
138+
"aggregate": "coll0",
139+
"pipeline": [
140+
{
141+
"$match": {}
142+
}
143+
],
144+
"allowDiskUse": true
145+
},
146+
"commandName": "aggregate",
147+
"databaseName": "crud-tests"
148+
}
149+
}
150+
]
151+
}
152+
]
153+
}
154+
]
155+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
description: aggregate-allowdiskuse
2+
3+
schemaVersion: '1.0'
4+
5+
createEntities:
6+
- client:
7+
id: &client0 client0
8+
observeEvents: [ commandStartedEvent ]
9+
- database:
10+
id: &database0 database0
11+
client: *client0
12+
databaseName: &database0Name crud-tests
13+
- collection:
14+
id: &collection0 collection0
15+
database: *database0
16+
collectionName: &collection0Name coll0
17+
18+
initialData:
19+
- collectionName: *collection0Name
20+
databaseName: *database0Name
21+
documents: []
22+
23+
tests:
24+
- description: 'Aggregate does not send allowDiskUse when value is not specified'
25+
operations:
26+
- object: *collection0
27+
name: aggregate
28+
arguments:
29+
pipeline: &pipeline [ { $match: {} } ]
30+
expectEvents:
31+
- client: *client0
32+
events:
33+
- commandStartedEvent:
34+
command:
35+
aggregate: *collection0Name
36+
pipeline: *pipeline
37+
allowDiskUse: { $$exists: false }
38+
commandName: aggregate
39+
databaseName: *database0Name
40+
41+
- description: 'Aggregate sends allowDiskUse false when false is specified'
42+
operations:
43+
- object: *collection0
44+
name: aggregate
45+
arguments:
46+
pipeline: *pipeline
47+
allowDiskUse: false
48+
expectEvents:
49+
- client: *client0
50+
events:
51+
- commandStartedEvent:
52+
command:
53+
aggregate: *collection0Name
54+
pipeline: *pipeline
55+
allowDiskUse: false
56+
commandName: aggregate
57+
databaseName: *database0Name
58+
59+
- description: 'Aggregate sends allowDiskUse true when true is specified'
60+
operations:
61+
- object: *collection0
62+
name: aggregate
63+
arguments:
64+
pipeline: *pipeline
65+
allowDiskUse: true
66+
expectEvents:
67+
- client: *client0
68+
events:
69+
- commandStartedEvent:
70+
command:
71+
aggregate: *collection0Name
72+
pipeline: *pipeline
73+
allowDiskUse: true
74+
commandName: aggregate
75+
databaseName: *database0Name

source/crud/tests/unified/find-allowdiskuse.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
],
3333
"tests": [
3434
{
35-
"description": "Find does not send allowDiskuse when value is not specified",
35+
"description": "Find does not send allowDiskUse when value is not specified",
3636
"operations": [
3737
{
3838
"object": "collection0",
@@ -61,7 +61,7 @@
6161
]
6262
},
6363
{
64-
"description": "Find sends allowDiskuse false when false is specified",
64+
"description": "Find sends allowDiskUse false when false is specified",
6565
"operations": [
6666
{
6767
"object": "collection0",

source/crud/tests/unified/find-allowdiskuse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ createEntities:
2424
collectionName: &collection_name test_find_allowdiskuse
2525
tests:
2626
-
27-
description: 'Find does not send allowDiskuse when value is not specified'
27+
description: 'Find does not send allowDiskUse when value is not specified'
2828
operations:
2929
-
3030
object: *collection0
@@ -42,7 +42,7 @@ tests:
4242
allowDiskUse:
4343
$$exists: false
4444
-
45-
description: 'Find sends allowDiskuse false when false is specified'
45+
description: 'Find sends allowDiskUse false when false is specified'
4646
operations:
4747
-
4848
object: *collection0

0 commit comments

Comments
 (0)