File: download.yml

package info (click to toggle)
golang-mongodb-mongo-driver 1.8.4%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 18,520 kB
  • sloc: perl: 533; ansic: 491; python: 432; makefile: 187; sh: 72
file content (192 lines) | stat: -rw-r--r-- 7,535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
data:
    files:
        -
            _id: { "$oid" : "000000000000000000000001" }
            length: 0
            chunkSize: 4
            uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
            md5: "d41d8cd98f00b204e9800998ecf8427e"
            filename: "length-0"
            contentType: "application/octet-stream"
            aliases: []
            metadata: {}
        -
            _id: { "$oid" : "000000000000000000000002" }
            length: 0
            chunkSize: 4
            uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
            md5: "d41d8cd98f00b204e9800998ecf8427e"
            filename: "length-0-with-empty-chunk"
            contentType: "application/octet-stream"
            aliases: []
            metadata: {}
        -
            _id: { "$oid" : "000000000000000000000003" }
            length: 2
            chunkSize: 4
            uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
            md5: "c700ed4fdb1d27055aa3faa2c2432283"
            filename: "length-2"
            contentType: "application/octet-stream"
            aliases: []
            metadata: {}
        -
            _id: { "$oid" : "000000000000000000000004" }
            length: 8
            chunkSize: 4
            uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
            md5: "dd254cdc958e53abaa67da9f797125f5"
            filename: "length-8"
            contentType: "application/octet-stream"
            aliases: []
            metadata: {}
        -
            _id: { "$oid" : "000000000000000000000005" }
            length: 10
            chunkSize: 4
            uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
            md5: "57d83cd477bfb1ccd975ab33d827a92b"
            filename: "length-10"
            contentType: "application/octet-stream"
            aliases: []
            metadata: {}
        -
            _id: { "$oid" : "000000000000000000000006" }
            length: 2
            chunkSize: 4
            uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
            md5: "c700ed4fdb1d27055aa3faa2c2432283"
            contentType: "application/octet-stream"
            aliases: []
            metadata: {}
    chunks:
        - { _id : { "$oid" : "000000000000000000000001" }, files_id : { "$oid" : "000000000000000000000002" }, n : 0, data : { $hex : "" } }
        - { _id : { "$oid" : "000000000000000000000002" }, files_id : { "$oid" : "000000000000000000000003" }, n : 0, data : { $hex : "1122" } }
        - { _id : { "$oid" : "000000000000000000000003" }, files_id : { "$oid" : "000000000000000000000004" }, n : 0, data : { $hex : "11223344" } }
        - { _id : { "$oid" : "000000000000000000000004" }, files_id : { "$oid" : "000000000000000000000004" }, n : 1, data : { $hex : "55667788" } }
        - { _id : { "$oid" : "000000000000000000000005" }, files_id : { "$oid" : "000000000000000000000005" }, n : 0, data : { $hex : "11223344" } }
        - { _id : { "$oid" : "000000000000000000000006" }, files_id : { "$oid" : "000000000000000000000005" }, n : 1, data : { $hex : "55667788" } }
        - { _id : { "$oid" : "000000000000000000000007" }, files_id : { "$oid" : "000000000000000000000005" }, n : 2, data : { $hex : "99aa" } }
        - { _id : { "$oid" : "000000000000000000000008" }, files_id : { "$oid" : "000000000000000000000006" }, n : 0, data : { $hex : "1122" } }

tests:
    -
        description: "Download when length is zero"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000001" }
                options: { }
        assert:
            result: { $hex : "" }
    -
        description: "Download when length is zero and there is one empty chunk"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000002" }
                options: { }
        assert:
            result: { $hex : "" }
    -
        description: "Download when there is one chunk"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000003" }
                options: { }
        assert:
            result: { $hex : "1122" }
    -
        description: "Download when there are two chunks"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000004" }
                options: { }
        assert:
            result: { $hex : "1122334455667788" }
    -
        description: "Download when there are three chunks"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000005" }
                options: { }
        assert:
            result: { $hex : "112233445566778899aa" }
    -
        description: "Download when files entry does not exist"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000000" }
                options: { }
        assert:
            error: "FileNotFound"
    -
        description: "Download when an intermediate chunk is missing"
        arrange:
            data:
                -
                    { delete : "fs.chunks", deletes : [
                        { q : { files_id : { "$oid" : "000000000000000000000005" }, n : 1 }, limit : 1 }
                    ] }
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000005" }
        assert:
            error: "ChunkIsMissing"
    -
        description: "Download when final chunk is missing"
        arrange:
            data:
                -
                    { delete : "fs.chunks", deletes : [
                        { q : { files_id : { "$oid" : "000000000000000000000005" }, n : 1 }, limit : 1 }
                    ] }
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000005" }
        assert:
            error: "ChunkIsMissing"
    -
        description: "Download when an intermediate chunk is the wrong size"
        arrange:
            data:
                -
                    { update : "fs.chunks", updates : [
                        { q : { files_id : { "$oid" : "000000000000000000000005" }, n : 1 }, u : { $set : { data : { $hex : "556677" } } } },
                        { q : { files_id : { "$oid" : "000000000000000000000005" }, n : 2 }, u : { $set : { data : { $hex : "8899aa" } } } }
                    ] }
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000005" }
        assert:
            error: "ChunkIsWrongSize"
    -
        description: "Download when final chunk is the wrong size"
        arrange:
            data:
                -
                    { update : "fs.chunks", updates : [
                        { q : { files_id : { "$oid" : "000000000000000000000005" }, n : 2 }, u : { $set : { data : { $hex : "99" } } } }
                    ] }
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000005" }
        assert:
            error: "ChunkIsWrongSize"
    -
        description: "Download legacy file with no name"
        act:
            operation: download
            arguments:
                id: { "$oid" : "000000000000000000000006" }
                options: { }
        assert:
            result: { $hex : "1122" }