...

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

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

     1description: "Parse logicalSessionTimeoutMinutes from replica set"
     2
     3uri: "mongodb://a/?replicaSet=rs"
     4
     5phases: [
     6    # An RSPrimary responds with a non-null logicalSessionTimeoutMinutes
     7    {
     8        responses: [
     9             ["a:27017", {
    10                ok: 1,
    11                helloOk: true,
    12                isWritablePrimary: true,
    13                hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
    14                setName: "rs",
    15                logicalSessionTimeoutMinutes: 3,
    16                minWireVersion: 0,
    17                maxWireVersion: 6
    18            }],
    19        ],
    20        outcome: {
    21            servers: {
    22                "a:27017": {
    23                    type: "RSPrimary",
    24                    setName: "rs"
    25                },
    26                "b:27017": {
    27                    type: "Unknown",
    28                },
    29                "c:27017": {
    30                    type: "Unknown",
    31                },
    32                "d:27017": {
    33                    type: "Unknown",
    34                },
    35                "e:27017": {
    36                    type: "Unknown",
    37                }
    38
    39            },
    40            topologyType: "ReplicaSetWithPrimary",
    41            logicalSessionTimeoutMinutes: 3,
    42            setName: "rs",
    43        }
    44    },
    45    # An RSGhost responds without a logicalSessionTimeoutMinutes
    46    {
    47        responses: [
    48            ["d:27017", {
    49                ok: 1,
    50                helloOk: true,
    51                isWritablePrimary: false,
    52                isreplicaset: true,
    53                minWireVersion: 0,
    54                maxWireVersion: 6
    55            }],
    56        ],
    57        outcome: {
    58            servers: {
    59                "a:27017": {
    60                    type: "RSPrimary",
    61                    setName: "rs"
    62                },
    63                "b:27017": {
    64                    type: "Unknown",
    65                },
    66                "c:27017": {
    67                    type: "Unknown",
    68                },
    69                "d:27017": {
    70                    type: "RSGhost",
    71                },
    72                "e:27017": {
    73                    type: "Unknown",
    74                }
    75
    76            },
    77            topologyType: "ReplicaSetWithPrimary",
    78            logicalSessionTimeoutMinutes: 3,
    79            setName: "rs",
    80        }
    81    },
    82    # An RSArbiter responds without a logicalSessionTimeoutMinutes
    83    {
    84        responses: [
    85           ["e:27017", {
    86                ok: 1,
    87                helloOk: true,
    88                isWritablePrimary: false,
    89                hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
    90                setName: "rs",
    91                arbiterOnly: true,
    92                minWireVersion: 0,
    93                maxWireVersion: 6
    94            }]
    95        ],
    96        outcome: {
    97            servers: {
    98                "a:27017": {
    99                    type: "RSPrimary",
   100                    setName: "rs"
   101                },
   102                "b:27017": {
   103                    type: "Unknown",
   104                },
   105                "c:27017": {
   106                    type: "Unknown",
   107                },
   108                "d:27017": {
   109                    type: "RSGhost",
   110                },
   111                "e:27017": {
   112                    type: "RSArbiter",
   113                    setName: "rs"
   114                }
   115
   116            },
   117            topologyType: "ReplicaSetWithPrimary",
   118            logicalSessionTimeoutMinutes: 3,
   119            setName: "rs",
   120        }
   121    },
   122    # An RSSecondary responds with a lower logicalSessionTimeoutMinutes
   123    {
   124        responses: [
   125            ["b:27017", {
   126                ok: 1,
   127                helloOk: true,
   128                isWritablePrimary: false,
   129                secondary: true,
   130                hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
   131                setName: "rs",
   132                logicalSessionTimeoutMinutes: 2,
   133                minWireVersion: 0,
   134                maxWireVersion: 6
   135            }],
   136        ],
   137        outcome: {
   138            servers: {
   139                "a:27017": {
   140                    type: "RSPrimary",
   141                    setName: "rs"
   142                },
   143                "b:27017": {
   144                    type: "RSSecondary",
   145                    setName: "rs"
   146                },
   147                "c:27017": {
   148                    type: "Unknown",
   149                },
   150                "d:27017": {
   151                    type: "RSGhost",
   152                },
   153                "e:27017": {
   154                    type: "RSArbiter",
   155                    setName: "rs"
   156                }
   157
   158            },
   159            topologyType: "ReplicaSetWithPrimary",
   160            logicalSessionTimeoutMinutes: 2,
   161            setName: "rs",
   162        }
   163    },
   164    # An RSOther responds with an even lower logicalSessionTimeoutMinutes, which is ignored
   165    {
   166        responses: [
   167            ["c:27017", {
   168                ok: 1,
   169                helloOk: true,
   170                isWritablePrimary: false,
   171                setName: "rs",
   172                hidden: true,
   173                logicalSessionTimeoutMinutes: 1,
   174                minWireVersion: 0,
   175                maxWireVersion: 6
   176            }],
   177        ],
   178        outcome: {
   179            servers: {
   180                "a:27017": {
   181                    type: "RSPrimary",
   182                    setName: "rs"
   183                },
   184                "b:27017": {
   185                    type: "RSSecondary",
   186                    setName: "rs"
   187                },
   188                "c:27017": {
   189                    type: "RSOther",
   190                    setName: "rs"
   191                },
   192                "d:27017": {
   193                    type: "RSGhost",
   194                },
   195                "e:27017": {
   196                    type: "RSArbiter",
   197                    setName: "rs"
   198              }
   199            },
   200            topologyType: "ReplicaSetWithPrimary",
   201            logicalSessionTimeoutMinutes: 2,
   202            setName: "rs",
   203        }
   204    },
   205    # Now the RSSecondary responds with no logicalSessionTimeoutMinutes
   206    {
   207        responses: [
   208            ["b:27017", {
   209                ok: 1,
   210                helloOk: true,
   211                isWritablePrimary: false,
   212                secondary: true,
   213                hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
   214                setName: "rs",
   215                logicalSessionTimeoutMinutes: null,
   216                minWireVersion: 0,
   217                maxWireVersion: 6
   218            }]
   219        ],
   220
   221        # Sessions aren't supported now
   222        outcome: {
   223            servers: {
   224                "a:27017": {
   225                    type: "RSPrimary",
   226                    setName: "rs"
   227                },
   228                "b:27017": {
   229                    type: "RSSecondary",
   230                    setName: "rs"
   231                },
   232                "c:27017": {
   233                    type: "RSOther",
   234                    setName: "rs"
   235                },
   236                "d:27017": {
   237                    type: "RSGhost",
   238                },
   239                "e:27017": {
   240                    type: "RSArbiter",
   241                    setName: "rs"
   242                }
   243            },
   244            topologyType: "ReplicaSetWithPrimary",
   245            logicalSessionTimeoutMinutes: null,
   246            setName: "rs",
   247        }
   248    }
   249]

View as plain text