...

Text file src/go.mongodb.org/mongo-driver/testdata/connection-monitoring-and-pooling/logging/connection-pool-options.yml

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

     1description: "connection-pool-options"
     2
     3schemaVersion: "1.13"
     4
     5runOnRequirements:
     6  - topologies:
     7    - single # The number of log messages is different for each topology since there is a connection pool per host.
     8
     9tests:
    10  - description: "Options should be included in connection pool created message when specified"
    11    operations:
    12      - name: createEntities
    13        object: testRunner
    14        arguments:
    15          entities:
    16            - client:
    17                id: &client client
    18                # Observe and wait on a connection ready event for the connection created in the background.
    19                # This is to avoid raciness around whether the background thread has created the connection
    20                # (and whether corresponding log messages have been generated) by the time log message assertions
    21                # are made.
    22                observeEvents:
    23                  - connectionReadyEvent
    24                observeLogMessages:
    25                  connection: debug
    26                uriOptions:
    27                  minPoolSize: 1
    28                  maxPoolSize: 5
    29                  maxIdleTimeMS: 10000
    30
    31      - name: waitForEvent
    32        object: testRunner
    33        arguments:
    34          client: *client
    35          event:
    36            connectionReadyEvent: {}
    37          count: 1
    38
    39    expectLogMessages:
    40      - client: *client
    41        messages:
    42          - level: debug
    43            component: connection
    44            data:
    45              message: "Connection pool created"
    46              serverHost: { $$type: string }
    47              serverPort: { $$type: [int, long] }
    48              minPoolSize: 1
    49              maxPoolSize: 5
    50              maxIdleTimeMS: 10000
    51
    52          - level: debug
    53            component: connection
    54            data:
    55              message: "Connection pool ready"
    56              serverHost: { $$type: string }
    57              serverPort: { $$type: [int, long] }
    58
    59          - level: debug
    60            component: connection
    61            data:
    62              message: "Connection created"
    63              driverConnectionId: { $$type: [int, long] }
    64              serverHost: { $$type: string }
    65              serverPort: { $$type: [int, long] }
    66
    67          - level: debug
    68            component: connection
    69            data:
    70              message: "Connection ready"
    71              driverConnectionId: { $$type: [int, long] }
    72              serverHost: { $$type: string }
    73              serverPort: { $$type: [int, long] }
    74              durationMS: { $$type: [double, int, long] }
    75
    76  # Drivers who have not done DRIVERS-1943 will need to skip this test.
    77  - description: "maxConnecting should be included in connection pool created message when specified"
    78    operations:
    79      - name: createEntities
    80        object: testRunner
    81        arguments:
    82          entities:
    83            - client:
    84                id: &client client
    85                # Observe and wait for a poolReadyEvent so we can ensure the pool has been created and is
    86                # ready by the time we assert on log messages, in order to avoid raciness around which messages
    87                # are emitted.
    88                observeEvents:
    89                  - poolReadyEvent
    90                observeLogMessages:
    91                  connection: debug
    92                uriOptions:
    93                  maxConnecting: 5
    94
    95      - name: waitForEvent
    96        object: testRunner
    97        arguments:
    98          client: *client
    99          event:
   100            poolReadyEvent: {}
   101          count: 1
   102
   103    expectLogMessages:
   104      - client: *client
   105        messages:
   106          - level: debug
   107            component: connection
   108            data:
   109              message: "Connection pool created"
   110              serverHost: { $$type: string }
   111              serverPort: { $$type: [int, long] }
   112              maxConnecting: 5
   113
   114          - level: debug
   115            component: connection
   116            data:
   117              message: "Connection pool ready"
   118              serverHost: { $$type: string }
   119              serverPort: { $$type: [int, long] }
   120
   121  # Drivers that do not support waitQueueTimeoutMS will need to skip this test.
   122  - description: "waitQueueTimeoutMS should be included in connection pool created message when specified"
   123    operations:
   124      - name: createEntities
   125        object: testRunner
   126        arguments:
   127          entities:
   128            - client:
   129                id: &client client
   130                # Observe and wait for a poolReadyEvent so we can ensure the pool has been created and is
   131                # ready by the time we assert on log messages, in order to avoid raciness around which messages
   132                # are emitted.
   133                observeEvents:
   134                  - poolReadyEvent
   135                observeLogMessages:
   136                  connection: debug
   137                uriOptions:
   138                  waitQueueTimeoutMS: 10000
   139
   140      - name: waitForEvent
   141        object: testRunner
   142        arguments:
   143          client: *client
   144          event:
   145            poolReadyEvent: {}
   146          count: 1
   147
   148    expectLogMessages:
   149      - client: *client
   150        messages:
   151          - level: debug
   152            component: connection
   153            data:
   154              message: "Connection pool created"
   155              serverHost: { $$type: string }
   156              serverPort: { $$type: [int, long] }
   157              waitQueueTimeoutMS: 10000
   158
   159          - level: debug
   160            component: connection
   161            data:
   162              message: "Connection pool ready"
   163              serverHost: { $$type: string }
   164              serverPort: { $$type: [int, long] }
   165
   166  # Drivers that do not support waitQueueSize will need to skip this test.
   167  - description: "waitQueueSize should be included in connection pool created message when specified"
   168    operations:
   169      - name: createEntities
   170        object: testRunner
   171        arguments:
   172          entities:
   173            - client:
   174                id: &client client
   175                # Observe and wait for a poolReadyEvent so we can ensure the pool has been created and is
   176                # ready by the time we assert on log messages, in order to avoid raciness around which messages
   177                # are emitted.
   178                observeEvents:
   179                  - poolReadyEvent
   180                observeLogMessages:
   181                  connection: debug
   182                uriOptions:
   183                  waitQueueSize: 100
   184
   185      - name: waitForEvent
   186        object: testRunner
   187        arguments:
   188          client: *client
   189          event:
   190            poolReadyEvent: {}
   191          count: 1
   192
   193    expectLogMessages:
   194      - client: *client
   195        messages:
   196          - level: debug
   197            component: connection
   198            data:
   199              message: "Connection pool created"
   200              serverHost: { $$type: string }
   201              serverPort: { $$type: [int, long] }
   202              waitQueueSize: 100
   203
   204          - level: debug
   205            component: connection
   206            data:
   207              message: "Connection pool ready"
   208              serverHost: { $$type: string }
   209              serverPort: { $$type: [int, long] }
   210
   211  # Drivers that do not support waitQueueMultiple will need to skip this test.
   212  - description: "waitQueueMultiple should be included in connection pool created message when specified"
   213    operations:
   214      - name: createEntities
   215        object: testRunner
   216        arguments:
   217          entities:
   218            - client:
   219                id: &client client
   220                # Observe and wait for a poolReadyEvent so we can ensure the pool has been created and is
   221                # ready by the time we assert on log messages, in order to avoid raciness around which messages
   222                # are emitted.
   223                observeEvents:
   224                  - poolReadyEvent
   225                observeLogMessages:
   226                  connection: debug
   227                uriOptions:
   228                  waitQueueSize: 5
   229
   230      - name: waitForEvent
   231        object: testRunner
   232        arguments:
   233          client: *client
   234          event:
   235            poolReadyEvent: {}
   236          count: 1
   237
   238    expectLogMessages:
   239      - client: *client
   240        messages:
   241          - level: debug
   242            component: connection
   243            data:
   244              message: "Connection pool created"
   245              serverHost: { $$type: string }
   246              serverPort: { $$type: [int, long] }
   247              waitQueueMultiple: 5
   248
   249          - level: debug
   250            component: connection
   251            data:
   252              message: "Connection pool ready"
   253              serverHost: { $$type: string }
   254              serverPort: { $$type: [int, long] }

View as plain text