...

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

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

     1description: "timeoutMS behaves correctly for GridFS find 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  - collectionName: *chunksCollectionName
    41    databaseName: *databaseName
    42    documents: []
    43
    44tests:
    45  - description: "timeoutMS can be overridden for a find"
    46    operations:
    47      - name: failPoint
    48        object: testRunner
    49        arguments:
    50          client: *failPointClient
    51          failPoint:
    52            configureFailPoint: failCommand
    53            mode: { times: 1 }
    54            data:
    55              failCommands: ["find"]
    56              blockConnection: true
    57              blockTimeMS: 100
    58      - name: find
    59        object: *bucket
    60        arguments:
    61          filter: {}
    62          timeoutMS: 1000 # The client timeoutMS is 75ms and the operation blocks for 100ms, so 1000ms should let it succeed.
    63    expectEvents:
    64      - client: *client
    65        events:
    66          - commandStartedEvent:
    67              commandName: find
    68              databaseName: *databaseName
    69              command:
    70                find: *filesCollectionName
    71                maxTimeMS: { $$type: ["int", "long"] }
    72
    73  - description: "timeoutMS applied to find command"
    74    operations:
    75      - name: failPoint
    76        object: testRunner
    77        arguments:
    78          client: *failPointClient
    79          failPoint:
    80            configureFailPoint: failCommand
    81            mode: { times: 1 }
    82            data:
    83              failCommands: ["find"]
    84              blockConnection: true
    85              blockTimeMS: 100
    86      - name: find
    87        object: *bucket
    88        arguments:
    89          filter: {}
    90        expectError:
    91          isTimeoutError: true
    92    expectEvents:
    93      - client: *client
    94        events:
    95          - commandStartedEvent:
    96              commandName: find
    97              databaseName: *databaseName
    98              command:
    99                find: *filesCollectionName
   100                maxTimeMS: { $$type: ["int", "long"] }

View as plain text