...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/integration/auth-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      authEnabled: true
     6
     7database_name: &database_name "sdam-tests"
     8collection_name: &collection_name "auth-network-timeout-error"
     9
    10data: &data
    11  - {_id: 1}
    12  - {_id: 2}
    13
    14tests:
    15  - description: Reset server and pool after network timeout error during authentication
    16    failPoint:
    17      configureFailPoint: failCommand
    18      mode: { times: 1 }
    19      data:
    20          failCommands: ["saslContinue"]
    21          blockConnection: true
    22          blockTimeMS: 500
    23          appName: authNetworkTimeoutErrorTest
    24    clientOptions:
    25      retryWrites: false
    26      appname: authNetworkTimeoutErrorTest
    27      # Set a short connect/socket timeout to ensure the fail point causes the
    28      # connection establishment to timeout.
    29      connectTimeoutMS: 250
    30      socketTimeoutMS: 250
    31    operations:
    32      - name: insertMany
    33        object: collection
    34        arguments:
    35          documents:
    36            - _id: 3
    37            - _id: 4
    38        error: true
    39      - name: waitForEvent
    40        object: testRunner
    41        arguments:
    42          event: ServerMarkedUnknownEvent
    43          count: 1
    44      - name: waitForEvent
    45        object: testRunner
    46        arguments:
    47          event: PoolClearedEvent
    48          count: 1
    49      # Perform another operation to ensure the node is rediscovered.
    50      - name: insertMany
    51        object: collection
    52        arguments:
    53          documents:
    54            - _id: 5
    55            - _id: 6
    56      # Assert the server was marked Unknown and pool was cleared exactly once.
    57      - name: assertEventCount
    58        object: testRunner
    59        arguments:
    60          event: ServerMarkedUnknownEvent
    61          count: 1
    62      - name: assertEventCount
    63        object: testRunner
    64        arguments:
    65          event: PoolClearedEvent
    66          count: 1
    67
    68    expectations:
    69      # Note: The first insert command is never attempted because connection
    70      # checkout fails.
    71      - command_started_event:
    72          command:
    73            insert: *collection_name
    74            documents:
    75              - _id: 5
    76              - _id: 6
    77          command_name: insert
    78          database_name: *database_name
    79
    80    outcome:
    81      collection:
    82        data:
    83          - {_id: 1}
    84          - {_id: 2}
    85          - {_id: 5}
    86          - {_id: 6}

View as plain text