...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/mapReduce.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: 0}
    14    - {_id: 2, x: 1}
    15    - {_id: 3, x: 2}
    16
    17tests:
    18    -
    19        description: "MapReduce succeeds with retry on"
    20        operations:
    21            - &operation_succeeds
    22                <<: &operation
    23                    name: mapReduce
    24                    object: collection
    25                    arguments:
    26                        map: { $code: "function inc() { return emit(0, this.x + 1) }" }
    27                        reduce: { $code:  "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" }
    28                        out: { inline: 1 }
    29                result: [ {  "_id" : 0, "value" : 6 } ]
    30        expectations:
    31            - &command_started_event
    32                command_started_event:
    33                    command:
    34                        mapReduce: *collection_name
    35                        map: { $code: "function inc() { return emit(0, this.x + 1) }" }
    36                        reduce: { $code:  "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" }
    37                        out: { inline: 1 }
    38                    database_name: *database_name
    39    -
    40        description: "MapReduce fails with retry on"
    41        failPoint: &failCommand_failPoint
    42            configureFailPoint: failCommand
    43            mode: { times: 1 }
    44            data:
    45                failCommands: [mapReduce]
    46                closeConnection: true
    47        operations:
    48            - &operation_fails
    49                <<: *operation
    50                error: true
    51        expectations:
    52             - *command_started_event
    53    -
    54        description: "MapReduce fails with retry off"
    55        clientOptions:
    56            retryReads: false
    57        failPoint: *failCommand_failPoint
    58        operations: [*operation_fails]
    59        expectations:
    60             - *command_started_event

View as plain text