...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/rs/topology_version_greater.yml

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

     1description: "Primary with newer topologyVersion"
     2
     3uri: "mongodb://a/?replicaSet=rs"
     4
     5phases: [
     6
     7    # Primary A is discovered
     8    {
     9        responses: [
    10            ["a:27017", {
    11                ok: 1,
    12                helloOk: true,
    13                isWritablePrimary: true,
    14                hosts: ["a:27017"],
    15                setName: "rs",
    16                minWireVersion: 0,
    17                maxWireVersion: 9,
    18                topologyVersion: {'processId': {"$oid": "000000000000000000000001"}, "counter": {"$numberLong": "1"}}
    19            }]
    20        ],
    21
    22        outcome: {
    23            servers: {
    24                "a:27017": {
    25                    type: "RSPrimary",
    26                    setName: "rs",
    27                    topologyVersion: {'processId': {"$oid": "000000000000000000000001"}, "counter": {"$numberLong": "1"}}
    28                }
    29            },
    30            topologyType: "ReplicaSetWithPrimary",
    31            logicalSessionTimeoutMinutes: null,
    32            setName: "rs",
    33        }
    34    },
    35
    36    # A responds with a greater topologyVersion counter, we should process the response.
    37    {
    38        responses: [
    39            ["a:27017", {
    40                ok: 1,
    41                helloOk: true,
    42                isWritablePrimary: true,
    43                hosts: ["a:27017", "b:27017"],
    44                setName: "rs",
    45                minWireVersion: 0,
    46                maxWireVersion: 9,
    47                topologyVersion: {'processId': {"$oid": "000000000000000000000001"}, "counter": {"$numberLong": "2"}}
    48            }]
    49        ],
    50
    51        outcome: {
    52            servers: {
    53                "a:27017": {
    54                    type: "RSPrimary",
    55                    setName: "rs",
    56                    topologyVersion: {'processId': {"$oid": "000000000000000000000001"}, "counter": {"$numberLong": "2"}}
    57                },
    58                "b:27017": {
    59
    60                    type: "Unknown",
    61                    topologyVersion: null
    62                }
    63            },
    64            topologyType: "ReplicaSetWithPrimary",
    65            logicalSessionTimeoutMinutes: null,
    66            setName: "rs",
    67        }
    68    },
    69
    70    # A responds with a different topologyVersion processId, we should process the response.
    71    {
    72        responses: [
    73            ["a:27017", {
    74                ok: 1,
    75                helloOk: true,
    76                isWritablePrimary: true,
    77                hosts: ["a:27017", "c:27017"],
    78                setName: "rs",
    79                minWireVersion: 0,
    80                maxWireVersion: 9,
    81                topologyVersion: {'processId': {"$oid": "000000000000000000000002"}, "counter": {"$numberLong": "0"}}
    82            }]
    83        ],
    84
    85        outcome: {
    86            servers: {
    87                "a:27017": {
    88                    type: "RSPrimary",
    89                    setName: "rs",
    90                    topologyVersion: {'processId': {"$oid": "000000000000000000000002"}, "counter": {"$numberLong": "0"}}
    91                },
    92                "c:27017": {
    93
    94                    type: "Unknown",
    95                    topologyVersion: null
    96                }
    97            },
    98            topologyType: "ReplicaSetWithPrimary",
    99            logicalSessionTimeoutMinutes: null,
   100            setName: "rs",
   101        }
   102    },
   103
   104    # A responds without a topologyVersion, we should process the response.
   105    {
   106        responses: [
   107            ["a:27017", {
   108                ok: 1,
   109                helloOk: true,
   110                isWritablePrimary: true,
   111                hosts: ["a:27017", "d:27017"],
   112                setName: "rs",
   113                minWireVersion: 0,
   114                maxWireVersion: 9
   115            }]
   116        ],
   117
   118        outcome: {
   119            servers: {
   120                "a:27017": {
   121                    type: "RSPrimary",
   122                    setName: "rs",
   123                    topologyVersion: null
   124                },
   125                "d:27017": {
   126
   127                    type: "Unknown",
   128                    topologyVersion: null
   129                }
   130            },
   131            topologyType: "ReplicaSetWithPrimary",
   132            logicalSessionTimeoutMinutes: null,
   133            setName: "rs",
   134        }
   135    },
   136
   137    # A responds with a topologyVersion again, we should process the response.
   138    {
   139        responses: [
   140            ["a:27017", {
   141                ok: 1,
   142                helloOk: true,
   143                isWritablePrimary: true,
   144                hosts: ["a:27017", "e:27017"],
   145                setName: "rs",
   146                minWireVersion: 0,
   147                maxWireVersion: 9,
   148                topologyVersion: {'processId': {"$oid": "000000000000000000000003"}, "counter": {"$numberLong": "0"}}
   149            }]
   150        ],
   151
   152        outcome: {
   153            servers: {
   154                "a:27017": {
   155                    type: "RSPrimary",
   156                    setName: "rs",
   157                    topologyVersion: {'processId': {"$oid": "000000000000000000000003"}, "counter": {"$numberLong": "0"}}
   158                },
   159                "e:27017": {
   160
   161                    type: "Unknown",
   162                    topologyVersion: null
   163                }
   164            },
   165            topologyType: "ReplicaSetWithPrimary",
   166            logicalSessionTimeoutMinutes: null,
   167            setName: "rs",
   168        }
   169    },
   170
   171    # A responds with a network error, we should process the response.
   172    {
   173        responses: [
   174            ["a:27017", {}]
   175        ],
   176
   177        outcome: {
   178            servers: {
   179                "a:27017": {
   180                    type: "Unknown",
   181                    topologyVersion: null
   182                },
   183                "e:27017": {
   184
   185                    type: "Unknown",
   186                    topologyVersion: null
   187                }
   188            },
   189            topologyType: "ReplicaSetNoPrimary",
   190            logicalSessionTimeoutMinutes: null,
   191            setName: "rs",
   192        }
   193    }
   194]

View as plain text