...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-operations-timeout/gridfs-advanced.yml

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-operations-timeout

     1description: "timeoutMS behaves correctly for advanced GridFS API operations"
     2
     3schemaVersion: "1.9"
     4
     5runOnRequirements:
     6  - minServerVersion: "4.4"
     7    serverless: forbid  # GridFS ops can be slow on serverless.
     8
     9createEntities:
    10  - client:
    11      id: &failPointClient failPointClient
    12      useMultipleMongoses: false
    13  - client:
    14      id: &client client
    15      uriOptions:
    16        timeoutMS: 75
    17      useMultipleMongoses: false
    18      observeEvents:
    19        - commandStartedEvent
    20  - database:
    21      id: &database database
    22      client: *client
    23      databaseName: &databaseName test
    24  - bucket:
    25      id: &bucket bucket
    26      database: *database
    27  - collection:
    28      id: &filesCollection filesCollection
    29      database: *database
    30      collectionName: &filesCollectionName fs.files
    31  - collection:
    32      id: &chunksCollection chunksCollection
    33      database: *database
    34      collectionName: &chunksCollectionName fs.chunks
    35
    36initialData:
    37  - collectionName: *filesCollectionName
    38    databaseName: *databaseName
    39    documents:
    40      - _id: &fileDocumentId { $oid: "000000000000000000000005" }
    41        length: 8
    42        chunkSize: 4
    43        uploadDate: { $date: "1970-01-01T00:00:00.000Z" }
    44        filename: "length-8"
    45        contentType: "application/octet-stream"
    46        aliases: []
    47        metadata: {}
    48  - collectionName: *chunksCollectionName
    49    databaseName: *databaseName
    50    documents:
    51      - _id: { $oid: "000000000000000000000005" }
    52        files_id: *fileDocumentId
    53        n: 0
    54        data: { $binary: { base64: "ESIzRA==", subType: "00" } } # hex: 11223344
    55      - _id: { $oid: "000000000000000000000006" }
    56        files_id: *fileDocumentId
    57        n: 1
    58        data: { $binary: { base64: "ESIzRA==", subType: "00" } } # hex: 11223344
    59
    60tests:
    61  # Tests for the "rename" operation.
    62
    63  - description: "timeoutMS can be overridden for a rename"
    64    operations:
    65      - name: failPoint
    66        object: testRunner
    67        arguments:
    68          client: *failPointClient
    69          failPoint:
    70            configureFailPoint: failCommand
    71            mode: { times: 1 }
    72            data:
    73              failCommands: ["update"]
    74              blockConnection: true
    75              blockTimeMS: 100
    76      - name: rename
    77        object: *bucket
    78        arguments:
    79          id: *fileDocumentId
    80          newFilename: "foo"
    81          timeoutMS: 2000 # The client timeoutMS is 75ms and the operation blocks for 100ms, so 2000ms should let it succeed.
    82    expectEvents:
    83      - client: *client
    84        events:
    85          - commandStartedEvent:
    86              commandName: update
    87              databaseName: *databaseName
    88              command:
    89                update: *filesCollectionName
    90                maxTimeMS: { $$type: ["int", "long"] }
    91
    92  - description: "timeoutMS applied to update during a rename"
    93    operations:
    94      - name: failPoint
    95        object: testRunner
    96        arguments:
    97          client: *failPointClient
    98          failPoint:
    99            configureFailPoint: failCommand
   100            mode: { times: 1 }
   101            data:
   102              failCommands: ["update"]
   103              blockConnection: true
   104              blockTimeMS: 100
   105      - name: rename
   106        object: *bucket
   107        arguments:
   108          id: *fileDocumentId
   109          newFilename: "foo"
   110        expectError:
   111          isTimeoutError: true
   112    expectEvents:
   113      - client: *client
   114        events:
   115          - commandStartedEvent:
   116              commandName: update
   117              databaseName: *databaseName
   118              command:
   119                update: *filesCollectionName
   120                maxTimeMS: { $$type: ["int", "long"] }
   121
   122  # Tests for the "drop" opration. Any tests that might result in multiple commands being sent do not have expectEvents
   123  # assertions as these assertions reduce test robustness and can cause flaky failures.
   124
   125  - description: "timeoutMS can be overridden for drop"
   126    operations:
   127      - name: failPoint
   128        object: testRunner
   129        arguments:
   130          client: *failPointClient
   131          failPoint:
   132            configureFailPoint: failCommand
   133            mode: { times: 1 }
   134            data:
   135              failCommands: ["drop"]
   136              blockConnection: true
   137              blockTimeMS: 100
   138      - name: drop
   139        object: *bucket
   140        arguments:
   141          timeoutMS: 2000 # The client timeoutMS is 75ms and the operation blocks for 100ms, so 2000ms should let it succeed.
   142
   143  - description: "timeoutMS applied to files collection drop"
   144    operations:
   145      - name: failPoint
   146        object: testRunner
   147        arguments:  
   148          client: *failPointClient
   149          failPoint:
   150            configureFailPoint: failCommand
   151            mode: { times: 1 }
   152            data:
   153              failCommands: ["drop"]
   154              blockConnection: true
   155              blockTimeMS: 100
   156      - name: drop
   157        object: *bucket
   158        expectError:
   159          isTimeoutError: true
   160    expectEvents:
   161      - client: *client
   162        events:
   163          - commandStartedEvent:
   164              commandName: drop
   165              databaseName: *databaseName
   166              command:
   167                drop: *filesCollectionName
   168                maxTimeMS: { $$type: ["int", "long"] }
   169
   170  - description: "timeoutMS applied to chunks collection drop"
   171    operations:
   172      - name: failPoint
   173        object: testRunner
   174        arguments:  
   175          client: *failPointClient
   176          failPoint:
   177            configureFailPoint: failCommand
   178            mode:
   179              # Skip the drop for the files collection.
   180              skip: 1
   181            data:
   182              failCommands: ["drop"]
   183              blockConnection: true
   184              blockTimeMS: 100
   185      - name: drop
   186        object: *bucket
   187        expectError:
   188          isTimeoutError: true
   189
   190  - description: "timeoutMS applied to drop as a whole, not individual parts"
   191    operations:
   192      - name: failPoint
   193        object: testRunner
   194        arguments:  
   195          client: *failPointClient
   196          failPoint:
   197            configureFailPoint: failCommand
   198            mode: { times: 2 }
   199            data:
   200              failCommands: ["drop"]
   201              blockConnection: true
   202              blockTimeMS: 50
   203      - name: drop
   204        object: *bucket
   205        expectError:
   206          isTimeoutError: true

View as plain text