...

Text file src/go.mongodb.org/mongo-driver/testdata/uri-options/read-preference-options.yml

Documentation: go.mongodb.org/mongo-driver/testdata/uri-options

     1tests:
     2    -
     3        description: "Valid read preference options are parsed correctly"
     4        uri: "mongodb://example.com/?readPreference=primaryPreferred&readPreferenceTags=dc:ny,rack:1&maxStalenessSeconds=120&readPreferenceTags=dc:ny"
     5        valid: true
     6        warning: false
     7        hosts: ~
     8        auth: ~
     9        options:
    10            readPreference: "primaryPreferred"
    11            readPreferenceTags:
    12                -
    13                    dc: "ny"
    14                    rack: "1"
    15                -
    16                    dc: "ny"
    17            maxStalenessSeconds: 120
    18    -
    19        description: "Single readPreferenceTags is parsed as array of size one"
    20        uri: "mongodb://example.com/?readPreference=secondary&readPreferenceTags=dc:ny"
    21        valid: true
    22        warning: false
    23        hosts: ~
    24        auth: ~
    25        options:
    26            readPreferenceTags:
    27                -
    28                    dc: "ny"
    29    -
    30        description: "Invalid readPreferenceTags causes a warning"
    31        uri: "mongodb://example.com/?readPreferenceTags=invalid"
    32        valid: true
    33        warning: true
    34        hosts: ~
    35        auth: ~
    36        options: {}
    37    -
    38        description: "Non-numeric maxStalenessSeconds causes a warning"
    39        uri: "mongodb://example.com/?maxStalenessSeconds=invalid"
    40        valid: true
    41        warning: true
    42        hosts: ~
    43        auth: ~
    44        options: {}
    45    -
    46        description: "Too low maxStalenessSeconds causes a warning"
    47        uri: "mongodb://example.com/?maxStalenessSeconds=-2"
    48        valid: true
    49        warning: true
    50        hosts: ~
    51        auth: ~
    52        options: {}
    53

View as plain text