File: gridfs-advanced.yml

package info (click to toggle)
ruby-mongo 2.21.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,764 kB
  • sloc: ruby: 108,806; makefile: 5; sh: 2
file content (207 lines) | stat: -rw-r--r-- 6,438 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
description: "timeoutMS behaves correctly for advanced GridFS API 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
      observeEvents:
        - commandStartedEvent
  - 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:
      - _id: &fileDocumentId { $oid: "000000000000000000000005" }
        length: 8
        chunkSize: 4
        uploadDate: { $date: "1970-01-01T00:00:00.000Z" }
        filename: "length-8"
        contentType: "application/octet-stream"
        aliases: []
        metadata: {}
  - collectionName: *chunksCollectionName
    databaseName: *databaseName
    documents:
      - _id: { $oid: "000000000000000000000005" }
        files_id: *fileDocumentId
        n: 0
        data: { $binary: { base64: "ESIzRA==", subType: "00" } } # hex: 11223344
      - _id: { $oid: "000000000000000000000006" }
        files_id: *fileDocumentId
        n: 1
        data: { $binary: { base64: "ESIzRA==", subType: "00" } } # hex: 11223344

tests:
  # Tests for the "rename" operation.
  # Ruby driver does not support rename for GridFS bucket

  # - description: "timeoutMS can be overridden for a rename"
  #   operations:
  #     - name: failPoint
  #       object: testRunner
  #       arguments:
  #         client: *failPointClient
  #         failPoint:
  #           configureFailPoint: failCommand
  #           mode: { times: 1 }
  #           data:
  #             failCommands: ["update"]
  #             blockConnection: true
  #             blockTimeMS: 100
  #     - name: rename
  #       object: *bucket
  #       arguments:
  #         id: *fileDocumentId
  #         newFilename: "foo"
  #         timeoutMS: 2000 # The client timeoutMS is 75ms and the operation blocks for 100ms, so 2000ms should let it succeed.
  #   expectEvents:
  #     - client: *client
  #       events:
  #         - commandStartedEvent:
  #             commandName: update
  #             databaseName: *databaseName
  #             command:
  #               update: *filesCollectionName
  #               maxTimeMS: { $$type: ["int", "long"] }

  # - description: "timeoutMS applied to update during a rename"
  #   operations:
  #     - name: failPoint
  #       object: testRunner
  #       arguments:
  #         client: *failPointClient
  #         failPoint:
  #           configureFailPoint: failCommand
  #           mode: { times: 1 }
  #           data:
  #             failCommands: ["update"]
  #             blockConnection: true
  #             blockTimeMS: 100
  #     - name: rename
  #       object: *bucket
  #       arguments:
  #         id: *fileDocumentId
  #         newFilename: "foo"
  #       expectError:
  #         isTimeoutError: true
  #   expectEvents:
  #     - client: *client
  #       events:
  #         - commandStartedEvent:
  #             commandName: update
  #             databaseName: *databaseName
  #             command:
  #               update: *filesCollectionName
  #               maxTimeMS: { $$type: ["int", "long"] }

  # Tests for the "drop" operation. Any tests that might result in multiple commands being sent do not have expectEvents
  # assertions as these assertions reduce test robustness and can cause flaky failures.

  - description: "timeoutMS can be overridden for drop"
    operations:
      - name: failPoint
        object: testRunner
        arguments:
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["drop"]
              blockConnection: true
              blockTimeMS: 100
      - name: drop
        object: *bucket
        arguments:
          timeoutMS: 2000 # The client timeoutMS is 75ms and the operation blocks for 100ms, so 2000ms should let it succeed.

  - description: "timeoutMS applied to files collection drop"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 1 }
            data:
              failCommands: ["drop"]
              blockConnection: true
              blockTimeMS: 100
      - name: drop
        object: *bucket
        expectError:
          isTimeoutError: true
    expectEvents:
      - client: *client
        events:
          - commandStartedEvent:
              commandName: drop
              databaseName: *databaseName
              command:
                drop: *filesCollectionName
                maxTimeMS: { $$type: ["int", "long"] }

  - description: "timeoutMS applied to chunks collection drop"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode:
              # Skip the drop for the files collection.
              skip: 1
            data:
              failCommands: ["drop"]
              blockConnection: true
              blockTimeMS: 100
      - name: drop
        object: *bucket
        expectError:
          isTimeoutError: true

  - description: "timeoutMS applied to drop as a whole, not individual parts"
    operations:
      - name: failPoint
        object: testRunner
        arguments:  
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 2 }
            data:
              failCommands: ["drop"]
              blockConnection: true
              blockTimeMS: 50
      - name: drop
        object: *bucket
        expectError:
          isTimeoutError: true