...

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

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

     1version: 1
     2style: integration
     3description: threads blocked by maxConnecting check out minPoolSize connections
     4runOn:
     5  -
     6    # required for blockConnection in fail point
     7    minServerVersion: "4.4.0"
     8failPoint:
     9  configureFailPoint: failCommand
    10  mode: "alwaysOn"
    11  data:
    12    failCommands: ["isMaster","hello"]
    13    closeConnection: false
    14    blockConnection: true
    15    blockTimeMS: 500
    16poolOptions:
    17  # allows both thread1 and the background thread to start opening connections concurrently
    18  minPoolSize: 2
    19  # gives opportunity for the checkout in thread2 to open a new connection, which it must not do nonetheless
    20  maxPoolSize: 3
    21  waitQueueTimeoutMS: 5000
    22operations:
    23  - name: ready
    24  # thread1 exists to hold on one of the two permits to open a connection (the other one is initially held by the background thread),
    25  # so that thread2 would be blocked acquiring a permit, which opens an opportunity for it to grab the connection newly opened
    26  # by the background thread instead of opening a third connection.
    27  - name: start
    28    target: thread1
    29  - name: start
    30    target: thread2
    31  # Ideally, thread1 should be holding for its permit to open a connection till the end of the test, but we cannot express that.
    32  # This delay emulates the above requirement:
    33  # - it is long enough to make sure that the background thread opens a connection before thread1 releases its permit;
    34  # - it is short enough to allow thread2 to become blocked acquiring a permit to open a connection, and then grab the connection
    35  #   opened by the background thread, before the background thread releases its permit.
    36  - name: wait
    37    ms: 200
    38  - name: checkOut
    39    thread: thread1
    40  - name: waitForEvent
    41    event: ConnectionCreated
    42    count: 2
    43  - name: checkOut
    44    thread: thread2
    45  - name: waitForEvent
    46    event: ConnectionCheckedOut
    47    count: 2
    48events:
    49  # exactly 2 connections must be created and checked out
    50  - type: ConnectionCreated
    51    address: 42
    52  - type: ConnectionCreated
    53    address: 42
    54  - type: ConnectionCheckedOut
    55    address: 42
    56  - type: ConnectionCheckedOut
    57    address: 42
    58ignore:
    59  - ConnectionPoolReady
    60  - ConnectionClosed
    61  - ConnectionReady
    62  - ConnectionPoolCreated
    63  - ConnectionCheckOutStarted

View as plain text