...

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

View as plain text