...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/countDocuments.yml

Documentation: go.mongodb.org/mongo-driver/testdata/retryable-reads

     1runOn:
     2    -
     3        minServerVersion: "4.0"
     4        topology: ["single", "replicaset"]
     5    -
     6        minServerVersion: "4.1.7"
     7        topology: ["sharded", "load-balanced"]
     8
     9database_name: &database_name "retryable-reads-tests"
    10collection_name: &collection_name "coll"
    11
    12data:
    13    - { _id: 1, x: 11 }
    14    - { _id: 2, x: 22 }
    15
    16tests:
    17    -
    18        description: "CountDocuments succeeds on first attempt"
    19        operations:
    20            - &retryable_operation_succeeds
    21                <<: &retryable_operation
    22                    name: countDocuments
    23                    object: collection
    24                    arguments: { filter: { } }
    25                result: 2
    26        expectations:
    27            -  &retryable_command_started_event
    28                command_started_event:
    29                  command:
    30                        aggregate: *collection_name
    31                        pipeline: [{'$match': {}}, {'$group': {'_id': 1, 'n': {'$sum': 1}}}]
    32                  database_name: *database_name
    33    -
    34        description: "CountDocuments succeeds on second attempt"
    35        failPoint:  &failCommand_failPoint
    36            configureFailPoint: failCommand
    37            mode: { times: 1 }
    38            data:
    39                failCommands: [aggregate]
    40                closeConnection: true
    41        operations: [*retryable_operation_succeeds]
    42        expectations:
    43             - *retryable_command_started_event
    44             - *retryable_command_started_event
    45    -
    46        description: "CountDocuments fails on first attempt"
    47        clientOptions:
    48            retryReads: false
    49        failPoint: *failCommand_failPoint
    50        operations:
    51            - &retryable_operation_fails
    52                <<: *retryable_operation
    53                error: true
    54        expectations:
    55             - *retryable_command_started_event
    56    -
    57        description: "CountDocuments fails on second attempt"
    58        failPoint:
    59            <<: *failCommand_failPoint
    60            mode: { times: 2 }
    61        operations: [*retryable_operation_fails]
    62        expectations:
    63             - *retryable_command_started_event
    64             - *retryable_command_started_event

View as plain text