...

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

View as plain text