File: gridfs-upload.yml

package info (click to toggle)
ruby-mongo 2.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,020 kB
  • sloc: ruby: 110,810; makefile: 5
file content (249 lines) | stat: -rw-r--r-- 8,129 bytes parent folder | download
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
description: "timeoutMS behaves correctly for GridFS upload operations"

schemaVersion: "1.9"

runOnRequirements:
  - minServerVersion: "4.4"
    serverless: forbid  # GridFS ops can be slow on serverless.

createEntities:
  - client:
      id: &failPointClient failPointClient
      useMultipleMongoses: false
  - client:
      id: &client client
      uriOptions:
        timeoutMS: 75
      useMultipleMongoses: false
  - database:
      id: &database database
      client: *client
      databaseName: &databaseName test
  - bucket:
      id: &bucket bucket
      database: *database
  - collection:
      id: &filesCollection filesCollection
      database: *database
      collectionName: &filesCollectionName fs.files
  - collection:
      id: &chunksCollection chunksCollection
      database: *database
      collectionName: &chunksCollectionName fs.chunks

initialData:
  - collectionName: *filesCollectionName
    databaseName: *databaseName
    documents: []
  - collectionName: *chunksCollectionName
    databaseName: *databaseName
    documents: []

tests:
  # Many tests in this file do not specify command monitoring expectations because GridFS uploads internally do a
  # number of operations, so expecting an exact set of commands can cause flaky failures.

  - description: "timeoutMS can be overridden for upload"
    operations:
      - name: failPoint
        object: testRunner
        arguments:
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["find"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
          timeoutMS: 1000

  # On the first write to the bucket, drivers check if the files collection is empty to see if indexes need to be
  # created.
  - description: "timeoutMS applied to initial find on files collection"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["find"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  # On the first write to the bucket, drivers check if the files collection has the correct indexes.
  - description: "timeoutMS applied to listIndexes on files collection"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["listIndexes"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  # If the files collection is empty when the first write to the bucket occurs, drivers attempt to create an index
  # on the bucket's files collection.
  - description: "timeoutMS applied to index creation for files collection"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["createIndexes"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  # On the first write to the bucket, drivers check if the chunks collection has the correct indexes.
  - description: "timeoutMS applied to listIndexes on chunks collection"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            # The first listIndexes will be on the files collection, so we skip it.
            mode: { skip: 1 }
            data:
              failCommands: ["listIndexes"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  # If the files collection is empty when the first write to the bucket occurs, drivers attempt to create an index
  # on the bucket's chunks collection.
  - description: "timeoutMS applied to index creation for chunks collection"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            # This index is created after the one on the files collection, so we skip the first createIndexes command
            # and target the second.
            mode: { skip: 1 }
            data:
              failCommands: ["createIndexes"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  - description: "timeoutMS applied to chunk insertion"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["insert"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  - description: "timeoutMS applied to creation of files document"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            # Skip the insert to upload the chunk. Because the whole file fits into one chunk, the second insert will
            # be the files document upload.
            mode: { skip: 1 }
            data:
              failCommands: ["insert"]
              blockConnection: true
              blockTimeMS: 100
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true

  # Test that drivers apply timeoutMS to the entire upload rather than refreshing it between individual commands. We
  # test this by blocking the "find" and "listIndexes" commands for 50ms each and performing an upload. The upload
  # should inherit timeoutMS=75 from the client/database and the server takes over 75ms total, so the operation should
  # fail.
  - description: "timeoutMS applied to upload as a whole, not individual parts"
    operations:
      - name: failPoint
        object: testRunner
        arguments:
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 2 }
            data:
              failCommands: ["find", "listIndexes"]
              blockConnection: true
              blockTimeMS: 50
      - name: upload
        object: *bucket
        arguments:
          filename: filename
          source: { $$hexBytes: "1122334455" }
        expectError:
          isTimeoutError: true