File: rediscover-quickly-after-step-down.yml

package info (click to toggle)
golang-mongodb-mongo-driver 1.8.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,500 kB
  • sloc: perl: 533; ansic: 491; python: 432; makefile: 187; sh: 72
file content (98 lines) | stat: -rw-r--r-- 2,736 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
runOn:
    # 4.4 is required for streaming.
    # A replica set is required for replSetStepDown.
    - minServerVersion: "4.4"
      topology: ["replicaset"]

database_name: &database_name "sdam-tests"
collection_name: &collection_name "test-replSetStepDown"

data: &data
  - {_id: 1}
  - {_id: 2}

tests:
  - description: Rediscover quickly after replSetStepDown
    clientOptions:
      appname: replSetStepDownTest
      # Configure a large heartbeatFrequencyMS
      heartbeatFrequencyMS: 60000
      # Configure a much smaller server selection timeout so that the test
      # will error when it cannot discover the new primary soon.
      serverSelectionTimeoutMS: 5000
      w: majority
    operations:
      # Discover the primary.
      - name: insertMany
        object: collection
        arguments:
          documents:
            - _id: 3
            - _id: 4
      - name: recordPrimary
        object: testRunner
      # Unfreeze a secondary with replSetFreeze:0 to ensure a speedy election.
      - name: runAdminCommand
        object: testRunner
        command_name: replSetFreeze
        arguments:
          command:
            replSetFreeze: 0
          readPreference:
            mode: Secondary
      # Run replSetStepDown on the meta client.
      - name: runAdminCommand
        object: testRunner
        command_name: replSetStepDown
        arguments:
          command:
            replSetStepDown: 30
            secondaryCatchUpPeriodSecs: 30
            force: false
      - name: waitForPrimaryChange
        object: testRunner
        arguments:
          # We use a relatively large timeout here to workaround slow
          # elections on Windows, possibly caused by SERVER-48154.
          timeoutMS: 15000
      # Rediscover the new primary.
      - name: insertMany
        object: collection
        arguments:
          documents:
            - _id: 5
            - _id: 6
      # Assert that no pools were cleared.
      - name: assertEventCount
        object: testRunner
        arguments:
          event: PoolClearedEvent
          count: 0

    expectations:
      - command_started_event:
          command:
            insert: *collection_name
            documents:
              - _id: 3
              - _id: 4
          command_name: insert
          database_name: *database_name
      - command_started_event:
          command:
            insert: *collection_name
            documents:
              - _id: 5
              - _id: 6
          command_name: insert
          database_name: *database_name

    outcome:
      collection:
        data:
          - {_id: 1}
          - {_id: 2}
          - {_id: 3}
          - {_id: 4}
          - {_id: 5}
          - {_id: 6}