...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/distinct.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    - {_id: 3, x: 33}
    16
    17tests:
    18    -
    19        description: "Distinct succeeds on first attempt"
    20        operations:
    21            - &retryable_operation_succeeds
    22                <<: &retryable_operation
    23                    name: distinct
    24                    object: collection
    25                    arguments: { fieldName: "x", filter: { _id: { $gt: 1 } } }
    26                result:
    27                    - 22
    28                    - 33
    29        expectations:
    30            - &retryable_command_started_event
    31                command_started_event:
    32                    command:
    33                        distinct: *collection_name
    34                        key: "x"
    35                        query:
    36                            _id: {$gt: 1}
    37                    database_name: *database_name
    38    -
    39        description: "Distinct succeeds on second attempt"
    40        failPoint:  &failCommand_failPoint
    41            configureFailPoint: failCommand
    42            mode: { times: 1 }
    43            data:
    44                failCommands: [distinct]
    45                closeConnection: true
    46        operations: [*retryable_operation_succeeds]
    47        expectations:
    48             - *retryable_command_started_event
    49             - *retryable_command_started_event
    50    -
    51        description: "Distinct fails on first attempt"
    52        clientOptions:
    53            retryReads: false
    54        failPoint: *failCommand_failPoint
    55        operations:
    56            - &retryable_operation_fails
    57                <<: *retryable_operation
    58                error: true
    59        expectations:
    60             - *retryable_command_started_event
    61
    62    -
    63        description: "Distinct fails on second attempt"
    64        failPoint:
    65            <<: *failCommand_failPoint
    66            mode: { times: 2 }
    67        operations: [*retryable_operation_fails]
    68        expectations:
    69             - *retryable_command_started_event
    70             - *retryable_command_started_event
    71

View as plain text