...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/integration/connectTimeoutMS.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 "connectTimeoutMS"
     8
     9data: []
    10
    11tests:
    12  - description: connectTimeoutMS=0
    13    clientOptions:
    14      retryWrites: false
    15      connectTimeoutMS: 0
    16      heartbeatFrequencyMS: 500
    17      appname: connectTimeoutMS=0
    18    operations:
    19      # Perform an operation to ensure the node is discovered.
    20      - name: insertMany
    21        object: collection
    22        arguments:
    23          documents:
    24            - _id: 1
    25            - _id: 2
    26      # Block the next streaming hello check for longer than
    27      # heartbeatFrequencyMS to ensure that the connection timeout remains
    28      # unlimited.
    29      - name: configureFailPoint
    30        object: testRunner
    31        arguments:
    32          failPoint:
    33            configureFailPoint: failCommand
    34            mode: { times: 2 }
    35            data:
    36                failCommands: ["hello", "isMaster"]
    37                appName: connectTimeoutMS=0
    38                blockConnection: true
    39                blockTimeMS: 550
    40      - name: wait
    41        object: testRunner
    42        arguments:
    43          ms: 750
    44      # Perform an operation to ensure the node is still selectable.
    45      - name: insertMany
    46        object: collection
    47        arguments:
    48          documents:
    49            - _id: 3
    50            - _id: 4
    51      # Assert that the server was never marked Unknown and the pool was never
    52      # cleared.
    53      - name: assertEventCount
    54        object: testRunner
    55        arguments:
    56          event: ServerMarkedUnknownEvent
    57          count: 0
    58      - name: assertEventCount
    59        object: testRunner
    60        arguments:
    61          event: PoolClearedEvent
    62          count: 0
    63
    64    expectations:
    65      - command_started_event:
    66          command:
    67            insert: *collection_name
    68            documents:
    69              - _id: 1
    70              - _id: 2
    71          command_name: insert
    72          database_name: *database_name
    73      - command_started_event:
    74          command:
    75            insert: *collection_name
    76            documents:
    77              - _id: 3
    78              - _id: 4
    79          command_name: insert
    80          database_name: *database_name
    81
    82    outcome:
    83      collection:
    84        data:
    85          - {_id: 1}
    86          - {_id: 2}
    87          - {_id: 3}
    88          - {_id: 4}

View as plain text