...

Text file src/go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling/wait-queue-fairness.yml

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

     1version: 1
     2style: unit
     3description: must issue Connections to threads in the order that the threads entered the queue
     4poolOptions:
     5  maxPoolSize: 1
     6  waitQueueTimeoutMS: 5000
     7operations:
     8  - name: ready
     9    # Check out sole connection in pool
    10  - name: checkOut
    11    label: conn0
    12    # Create 4 threads, have them all queue up for connections
    13    # Note: this might become non-deterministic depending on how you
    14    # implement your test runner. The goal is for each thread to
    15    # have started and begun checkOut before the next thread starts.
    16    # The sleep operations should make this more consistent.
    17  - name: start
    18    target: thread1
    19  - name: checkOut
    20    thread: thread1
    21    label: conn1
    22  - name: waitForEvent
    23    event: ConnectionCheckOutStarted
    24    count: 2
    25    # Give thread1 some time to actually enter the wait queue since the
    26    # ConnectionCheckOutStarted event is publish beforehand.
    27  - name: wait
    28    ms: 100
    29  - name: start
    30    target: thread2
    31  - name: checkOut
    32    thread: thread2
    33    label: conn2
    34  - name: waitForEvent
    35    event: ConnectionCheckOutStarted
    36    count: 3
    37    # Give thread2 some time to actually enter the wait queue since the
    38    # ConnectionCheckOutStarted event is publish beforehand.
    39  - name: wait
    40    ms: 100
    41  - name: start
    42    target: thread3
    43  - name: checkOut
    44    thread: thread3
    45    label: conn3
    46  - name: waitForEvent
    47    event: ConnectionCheckOutStarted
    48    count: 4
    49    # Give thread3 some time to actually enter the wait queue since the
    50    # ConnectionCheckOutStarted event is publish beforehand.
    51  - name: wait
    52    ms: 100
    53  - name: start
    54    target: thread4
    55  - name: checkOut
    56    thread: thread4
    57    label: conn4
    58  - name: waitForEvent
    59    event: ConnectionCheckOutStarted
    60    count: 5
    61    # Give thread4 some time to actually enter the wait queue since the
    62    # ConnectionCheckOutStarted event is publish beforehand.
    63  - name: wait
    64    ms: 100
    65    # From main thread, keep checking in connection and then wait for appropriate thread
    66    # Test will timeout if threads are not enqueued in proper order
    67  - name: checkIn
    68    connection: conn0
    69  - name: waitForThread
    70    target: thread1
    71  - name: checkIn
    72    connection: conn1
    73  - name: waitForThread
    74    target: thread2
    75  - name: checkIn
    76    connection: conn2
    77  - name: waitForThread
    78    target: thread3
    79  - name: checkIn
    80    connection: conn3
    81  - name: waitForThread
    82    target: thread4
    83events:
    84  - type: ConnectionCheckOutStarted
    85    address: 42
    86  - type: ConnectionCheckedOut
    87    connectionId: 42
    88    address: 42
    89  - type: ConnectionCheckOutStarted
    90    address: 42
    91  - type: ConnectionCheckOutStarted
    92    address: 42
    93  - type: ConnectionCheckOutStarted
    94    address: 42
    95  - type: ConnectionCheckOutStarted
    96    address: 42
    97  - type: ConnectionCheckedIn
    98    connectionId: 42
    99    address: 42
   100  - type: ConnectionCheckedOut
   101    connectionId: 42
   102    address: 42
   103  - type: ConnectionCheckedIn
   104    connectionId: 42
   105    address: 42
   106  - type: ConnectionCheckedOut
   107    connectionId: 42
   108    address: 42
   109  - type: ConnectionCheckedIn
   110    connectionId: 42
   111    address: 42
   112  - type: ConnectionCheckedOut
   113    connectionId: 42
   114    address: 42
   115  - type: ConnectionCheckedIn
   116    connectionId: 42
   117    address: 42
   118  - type: ConnectionCheckedOut
   119    connectionId: 42
   120    address: 42
   121ignore:
   122  - ConnectionCreated
   123  - ConnectionReady
   124  - ConnectionClosed
   125  - ConnectionPoolReady
   126  - ConnectionPoolCreated

View as plain text