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: "EstimatedDocumentCount succeeds on first attempt"
19        operations:
20            - &retryable_operation_succeeds
21                <<: &retryable_operation
22                    name: estimatedDocumentCount
23                    object: collection
24                result: 2
25        expectations:
26            - &retryable_command_started_event
27                command_started_event:
28                    command:
29                        count: *collection_name
30                    database_name: *database_name
31    -
32        description: "EstimatedDocumentCount succeeds on second attempt"
33        failPoint:  &failCommand_failPoint
34            configureFailPoint: failCommand
35            mode: { times: 1 }
36            data:
37                failCommands: [count]
38                closeConnection: true
39        operations: [*retryable_operation_succeeds]
40        expectations:
41             - *retryable_command_started_event
42             - *retryable_command_started_event
43    -
44        description: "EstimatedDocumentCount fails on first attempt"
45        clientOptions:
46            retryReads: false
47        failPoint: *failCommand_failPoint
48        operations:
49            - &retryable_operation_fails
50                <<: *retryable_operation
51                error: true
52        expectations:
53             - *retryable_command_started_event
54    -
55        description: "EstimatedDocumentCount fails on second attempt"
56        failPoint:
57          <<: *failCommand_failPoint
58          mode: { times: 2 }
59        operations: [*retryable_operation_fails]
60        expectations:
61             - *retryable_command_started_event
62             - *retryable_command_started_event
63