...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/integration/find-network-timeout-error.yml

Documentation: go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/integration

     1# Test SDAM error handling.
     2runOn:
     3    # failCommand appName requirements
     4    - minServerVersion: "4.4"
     5
     6database_name: &database_name "sdam-tests"
     7collection_name: &collection_name "find-network-timeout-error"
     8
     9data: &data
    10  - {_id: 1}
    11  - {_id: 2}
    12
    13tests:
    14  - description: Ignore network timeout error on find
    15    failPoint:
    16      configureFailPoint: failCommand
    17      mode: { times: 1 }
    18      data:
    19          failCommands: ["find"]
    20          blockConnection: true
    21          blockTimeMS: 500
    22          appName: findNetworkTimeoutErrorTest
    23    clientOptions:
    24      retryWrites: false
    25      retryReads: false
    26      appname: findNetworkTimeoutErrorTest
    27      # Set a short socket timeout to ensure the find command times out.
    28      socketTimeoutMS: 250
    29    operations:
    30      - name: find
    31        object: collection
    32        arguments:
    33          filter:
    34            _id: 1
    35        error: true
    36      # Perform another operation to ensure the node is still usable.
    37      - name: insertOne
    38        object: collection
    39        arguments:
    40          document:
    41            _id: 3
    42      # Assert the server was not marked Unknown and the pool was not cleared.
    43      - name: assertEventCount
    44        object: testRunner
    45        arguments:
    46          event: ServerMarkedUnknownEvent
    47          count: 0
    48      - name: assertEventCount
    49        object: testRunner
    50        arguments:
    51          event: PoolClearedEvent
    52          count: 0
    53
    54    expectations:
    55      - command_started_event:
    56          command:
    57            find: *collection_name
    58          command_name: find
    59          database_name: *database_name
    60      - command_started_event:
    61          command:
    62            insert: *collection_name
    63            documents:
    64              - _id: 3
    65          command_name: insert
    66          database_name: *database_name
    67
    68    outcome:
    69      collection:
    70        data:
    71          - {_id: 1}
    72          - {_id: 2}
    73          - {_id: 3}

View as plain text