...

Text file src/go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling/pool-checkout-maxConnecting-is-enforced.yml

Documentation: go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling

     1version: 1
     2style: integration
     3description: maxConnecting is enforced
     4runOn:
     5  -
     6    # required for blockConnection in fail point
     7    minServerVersion: "4.4.0"
     8failPoint:
     9  configureFailPoint: failCommand
    10  # high amount to ensure not interfered with by monitor checks.
    11  mode: { times: 50 }
    12  data:
    13    failCommands: ["isMaster","hello"]
    14    closeConnection: false
    15    blockConnection: true
    16    blockTimeMS: 750
    17poolOptions:
    18  maxPoolSize: 10
    19  waitQueueTimeoutMS: 5000
    20operations:
    21  - name: ready
    22  # start 3 threads
    23  - name: start
    24    target: thread1
    25  - name: start
    26    target: thread2
    27  - name: start
    28    target: thread3
    29  # start creating a Connection. This will take a while
    30  # due to the fail point.
    31  - name: checkOut
    32    thread: thread1
    33  # wait for thread1 to actually start creating a Connection
    34  - name: waitForEvent
    35    event: ConnectionCreated
    36    count: 1
    37  # wait some more time to ensure thread1 has begun establishing a Connection
    38  - name: wait
    39    ms: 100
    40  # start 2 check out requests. Only one thread should
    41  # start creating a Connection and the other one should be
    42  # waiting for pendingConnectionCount to be less than maxConnecting,
    43  # only starting once thread1 finishes creating its Connection.
    44  - name: checkOut
    45    thread: thread2
    46  - name: checkOut
    47    thread: thread3
    48  # wait until all Connections have been created.
    49  - name: waitForEvent
    50    event: ConnectionReady
    51    count: 3
    52events:
    53  # thread1 creates its connection
    54  - type: ConnectionCreated
    55    address: 42
    56    connectionId: 1
    57  # either thread2 or thread3 creates its connection
    58  # the other thread is stuck waiting for maxConnecting to come down
    59  - type: ConnectionCreated
    60    address: 42
    61  # thread1 finishes establishing its connection, freeing
    62  # up the blocked thread to start establishing
    63  - type: ConnectionReady
    64    address: 42
    65    connectionId: 1
    66  - type: ConnectionCreated
    67    address: 42
    68  # the remaining two Connections finish establishing
    69  - type: ConnectionReady
    70    address: 42
    71  - type: ConnectionReady
    72    address: 42
    73ignore:
    74  - ConnectionCheckOutStarted
    75  - ConnectionCheckedIn
    76  - ConnectionCheckedOut
    77  - ConnectionClosed
    78  - ConnectionPoolCreated
    79  - ConnectionPoolReady

View as plain text