Skip to content

Commit 4715d3e

Browse files
CSHARP-2201: Resync GridFS tests to add test for legacy GridFS, where no filename was set.
1 parent 1dec08f commit 4715d3e

File tree

2 files changed

+79
-38
lines changed

2 files changed

+79
-38
lines changed

tests/MongoDB.Driver.GridFS.Tests/Specifications/gridfs/tests/download.json

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
"md5": "d41d8cd98f00b204e9800998ecf8427e",
1414
"filename": "length-0",
1515
"contentType": "application/octet-stream",
16-
"aliases": [
17-
18-
],
19-
"metadata": {
20-
}
16+
"aliases": [],
17+
"metadata": {}
2118
},
2219
{
2320
"_id": {
@@ -31,11 +28,8 @@
3128
"md5": "d41d8cd98f00b204e9800998ecf8427e",
3229
"filename": "length-0-with-empty-chunk",
3330
"contentType": "application/octet-stream",
34-
"aliases": [
35-
36-
],
37-
"metadata": {
38-
}
31+
"aliases": [],
32+
"metadata": {}
3933
},
4034
{
4135
"_id": {
@@ -49,11 +43,8 @@
4943
"md5": "c700ed4fdb1d27055aa3faa2c2432283",
5044
"filename": "length-2",
5145
"contentType": "application/octet-stream",
52-
"aliases": [
53-
54-
],
55-
"metadata": {
56-
}
46+
"aliases": [],
47+
"metadata": {}
5748
},
5849
{
5950
"_id": {
@@ -67,11 +58,8 @@
6758
"md5": "dd254cdc958e53abaa67da9f797125f5",
6859
"filename": "length-8",
6960
"contentType": "application/octet-stream",
70-
"aliases": [
71-
72-
],
73-
"metadata": {
74-
}
61+
"aliases": [],
62+
"metadata": {}
7563
},
7664
{
7765
"_id": {
@@ -85,11 +73,22 @@
8573
"md5": "57d83cd477bfb1ccd975ab33d827a92b",
8674
"filename": "length-10",
8775
"contentType": "application/octet-stream",
88-
"aliases": [
89-
90-
],
91-
"metadata": {
92-
}
76+
"aliases": [],
77+
"metadata": {}
78+
},
79+
{
80+
"_id": {
81+
"$oid": "000000000000000000000006"
82+
},
83+
"length": 2,
84+
"chunkSize": 4,
85+
"uploadDate": {
86+
"$date": "1970-01-01T00:00:00.000Z"
87+
},
88+
"md5": "c700ed4fdb1d27055aa3faa2c2432283",
89+
"contentType": "application/octet-stream",
90+
"aliases": [],
91+
"metadata": {}
9392
}
9493
],
9594
"chunks": [
@@ -176,6 +175,18 @@
176175
"data": {
177176
"$hex": "99aa"
178177
}
178+
},
179+
{
180+
"_id": {
181+
"$oid": "000000000000000000000008"
182+
},
183+
"files_id": {
184+
"$oid": "000000000000000000000006"
185+
},
186+
"n": 0,
187+
"data": {
188+
"$hex": "1122"
189+
}
179190
}
180191
]
181192
},
@@ -188,8 +199,7 @@
188199
"id": {
189200
"$oid": "000000000000000000000001"
190201
},
191-
"options": {
192-
}
202+
"options": {}
193203
}
194204
},
195205
"assert": {
@@ -206,8 +216,7 @@
206216
"id": {
207217
"$oid": "000000000000000000000002"
208218
},
209-
"options": {
210-
}
219+
"options": {}
211220
}
212221
},
213222
"assert": {
@@ -224,8 +233,7 @@
224233
"id": {
225234
"$oid": "000000000000000000000003"
226235
},
227-
"options": {
228-
}
236+
"options": {}
229237
}
230238
},
231239
"assert": {
@@ -242,8 +250,7 @@
242250
"id": {
243251
"$oid": "000000000000000000000004"
244252
},
245-
"options": {
246-
}
253+
"options": {}
247254
}
248255
},
249256
"assert": {
@@ -260,8 +267,7 @@
260267
"id": {
261268
"$oid": "000000000000000000000005"
262269
},
263-
"options": {
264-
}
270+
"options": {}
265271
}
266272
},
267273
"assert": {
@@ -278,8 +284,7 @@
278284
"id": {
279285
"$oid": "000000000000000000000000"
280286
},
281-
"options": {
282-
}
287+
"options": {}
283288
}
284289
},
285290
"assert": {
@@ -440,6 +445,23 @@
440445
"assert": {
441446
"error": "ChunkIsWrongSize"
442447
}
448+
},
449+
{
450+
"description": "Download legacy file with no name",
451+
"act": {
452+
"operation": "download",
453+
"arguments": {
454+
"id": {
455+
"$oid": "000000000000000000000006"
456+
},
457+
"options": {}
458+
}
459+
},
460+
"assert": {
461+
"result": {
462+
"$hex": "1122"
463+
}
464+
}
443465
}
444466
]
445-
}
467+
}

tests/MongoDB.Driver.GridFS.Tests/Specifications/gridfs/tests/download.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
contentType: "application/octet-stream"
5151
aliases: []
5252
metadata: {}
53+
-
54+
_id: { "$oid" : "000000000000000000000006" }
55+
length: 2
56+
chunkSize: 4
57+
uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
58+
md5: "c700ed4fdb1d27055aa3faa2c2432283"
59+
contentType: "application/octet-stream"
60+
aliases: []
61+
metadata: {}
5362
chunks:
5463
- { _id : { "$oid" : "000000000000000000000001" }, files_id : { "$oid" : "000000000000000000000002" }, n : 0, data : { $hex : "" } }
5564
- { _id : { "$oid" : "000000000000000000000002" }, files_id : { "$oid" : "000000000000000000000003" }, n : 0, data : { $hex : "1122" } }
@@ -58,6 +67,7 @@
5867
- { _id : { "$oid" : "000000000000000000000005" }, files_id : { "$oid" : "000000000000000000000005" }, n : 0, data : { $hex : "11223344" } }
5968
- { _id : { "$oid" : "000000000000000000000006" }, files_id : { "$oid" : "000000000000000000000005" }, n : 1, data : { $hex : "55667788" } }
6069
- { _id : { "$oid" : "000000000000000000000007" }, files_id : { "$oid" : "000000000000000000000005" }, n : 2, data : { $hex : "99aa" } }
70+
- { _id : { "$oid" : "000000000000000000000008" }, files_id : { "$oid" : "000000000000000000000006" }, n : 0, data : { $hex : "1122" } }
6171

6272
tests:
6373
-
@@ -171,3 +181,12 @@ tests:
171181
id: { "$oid" : "000000000000000000000005" }
172182
assert:
173183
error: "ChunkIsWrongSize"
184+
-
185+
description: "Download legacy file with no name"
186+
act:
187+
operation: download
188+
arguments:
189+
id: { "$oid" : "000000000000000000000006" }
190+
options: { }
191+
assert:
192+
result: { $hex : "1122" }

0 commit comments

Comments
 (0)