...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/integration/rediscover-quickly-after-step-down.yml

Documentation: go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/integration

     1runOn:
     2    # 4.4 is required for streaming.
     3    # A replica set is required for replSetStepDown.
     4    - minServerVersion: "4.4"
     5      topology: ["replicaset"]
     6
     7database_name: &database_name "sdam-tests"
     8collection_name: &collection_name "test-replSetStepDown"
     9
    10data: &data
    11  - {_id: 1}
    12  - {_id: 2}
    13
    14tests:
    15  - description: Rediscover quickly after replSetStepDown
    16    clientOptions:
    17      appname: replSetStepDownTest
    18      # Configure a large heartbeatFrequencyMS
    19      heartbeatFrequencyMS: 60000
    20      # Configure a much smaller server selection timeout so that the test
    21      # will error when it cannot discover the new primary soon.
    22      serverSelectionTimeoutMS: 5000
    23      w: majority
    24    operations:
    25      # Discover the primary.
    26      - name: insertMany
    27        object: collection
    28        arguments:
    29          documents:
    30            - _id: 3
    31            - _id: 4
    32      - name: recordPrimary
    33        object: testRunner
    34      # Unfreeze a secondary with replSetFreeze:0 to ensure a speedy election.
    35      - name: runAdminCommand
    36        object: testRunner
    37        command_name: replSetFreeze
    38        arguments:
    39          command:
    40            replSetFreeze: 0
    41          readPreference:
    42            mode: Secondary
    43      # Run replSetStepDown on the meta client.
    44      - name: runAdminCommand
    45        object: testRunner
    46        command_name: replSetStepDown
    47        arguments:
    48          command:
    49            replSetStepDown: 30
    50            secondaryCatchUpPeriodSecs: 30
    51            force: false
    52      - name: waitForPrimaryChange
    53        object: testRunner
    54        arguments:
    55          # We use a relatively large timeout here to workaround slow
    56          # elections on Windows, possibly caused by SERVER-48154.
    57          timeoutMS: 15000
    58      # Rediscover the new primary.
    59      - name: insertMany
    60        object: collection
    61        arguments:
    62          documents:
    63            - _id: 5
    64            - _id: 6
    65      # Assert that no pools were cleared.
    66      - name: assertEventCount
    67        object: testRunner
    68        arguments:
    69          event: PoolClearedEvent
    70          count: 0
    71
    72    expectations:
    73      - command_started_event:
    74          command:
    75            insert: *collection_name
    76            documents:
    77              - _id: 3
    78              - _id: 4
    79          command_name: insert
    80          database_name: *database_name
    81      - command_started_event:
    82          command:
    83            insert: *collection_name
    84            documents:
    85              - _id: 5
    86              - _id: 6
    87          command_name: insert
    88          database_name: *database_name
    89
    90    outcome:
    91      collection:
    92        data:
    93          - {_id: 1}
    94          - {_id: 2}
    95          - {_id: 3}
    96          - {_id: 4}
    97          - {_id: 5}
    98          - {_id: 6}

View as plain text