...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/errors/prefer-error-code.yml

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

     1description: Do not check errmsg when code exists
     2uri: mongodb://a/?replicaSet=rs
     3phases:
     4- description: Primary A is discovered
     5  responses:
     6  - - a:27017
     7    - ok: 1
     8      helloOk: true
     9      isWritablePrimary: true
    10      hosts:
    11      - a:27017
    12      setName: rs
    13      minWireVersion: 0
    14      maxWireVersion: 9
    15      topologyVersion: &topologyVersion_1_1
    16        processId:
    17          "$oid": '000000000000000000000001'
    18        counter:
    19          "$numberLong": '1'
    20  outcome: &outcome
    21    servers:
    22      a:27017:
    23        type: RSPrimary
    24        setName: rs
    25        topologyVersion: *topologyVersion_1_1
    26        pool:
    27          generation: 0
    28    topologyType: ReplicaSetWithPrimary
    29    logicalSessionTimeoutMinutes: null
    30    setName: rs
    31
    32- description: errmsg "not master" gets ignored when error code exists
    33  applicationErrors:
    34  - address: a:27017
    35    when: afterHandshakeCompletes
    36    maxWireVersion: 9
    37    type: command
    38    response:
    39      ok: 0
    40      errmsg: "not master"  # NOTE: This needs to be "not master" and not "not writable primary".
    41      code: 1  # Not a "not writable primary" error code.
    42  outcome: *outcome
    43
    44- description: errmsg "node is recovering" gets ignored when error code exists
    45  applicationErrors:
    46  - address: a:27017
    47    when: afterHandshakeCompletes
    48    maxWireVersion: 9
    49    type: command
    50    response:
    51      ok: 0
    52      errmsg: "node is recovering"
    53      code: 1  # Not a "node is recovering" error code.
    54  outcome: *outcome

View as plain text