...

Text file src/go.mongodb.org/mongo-driver/testdata/load-balancers/server-selection.yml

Documentation: go.mongodb.org/mongo-driver/testdata/load-balancers

     1description: server selection for load-balanced clusters
     2
     3schemaVersion: '1.3'
     4
     5runOnRequirements:
     6  - topologies: [ load-balanced ]
     7
     8createEntities:
     9  - client:
    10      id: &client0 client0
    11      useMultipleMongoses: true
    12      observeEvents:
    13        - commandStartedEvent
    14  - database:
    15      id: &database0 database0
    16      client: *client0
    17      databaseName: &database0Name database0Name
    18  - collection:
    19      id: &collection0 collection0
    20      database: *database0
    21      collectionName: &collection0Name coll0
    22      collectionOptions:
    23        readPreference:
    24          # Use secondaryPreferred to ensure that operations can succeed even if the shards are only comprised of one
    25          # server.
    26          mode: &readPrefMode secondaryPreferred
    27
    28initialData:
    29  - collectionName: *collection0Name
    30    databaseName: *database0Name
    31    documents: []
    32
    33tests:
    34  - description: $readPreference is sent for load-balanced clusters
    35    operations:
    36      - name: find
    37        object: *collection0
    38        arguments:
    39          filter: {}
    40    expectEvents:
    41      - client: *client0
    42        events:
    43          - commandStartedEvent:
    44              command:
    45                find: *collection0Name
    46                filter: {}
    47                $readPreference:
    48                  mode: *readPrefMode
    49              commandName: find
    50              databaseName: *database0Name

View as plain text