...

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

View as plain text