1runOn:
2    -
3        minServerVersion: "4.0"
4        topology: ["single", "replicaset"]
5    -
6        minServerVersion: "4.1.7"
7        topology: ["sharded"]
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: "Count succeeds on first attempt"
19        operations:
20            - &retryable_operation_succeeds
21                <<: &retryable_operation
22                    name: count
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                    database_name: *database_name
32    -
33        description: "Count succeeds on second attempt"
34        failPoint:  &failCommand_failPoint
35            configureFailPoint: failCommand
36            mode: { times: 1 }
37            data:
38                failCommands: [aggregate]
39                closeConnection: true
40
41        operations: [*retryable_operation_succeeds]
42        expectations:
43             - *retryable_command_started_event
44             - *retryable_command_started_event
45    -
46        description: "Count 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: "Count 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
65