...

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

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

     1description: "Primary reports a new member"
     2
     3uri: "mongodb://a/?replicaSet=rs"
     4
     5phases: [
     6
     7    # At first, a is a secondary.
     8    {
     9        responses: [
    10
    11                ["a:27017", {
    12
    13                    ok: 1,
    14                    helloOk: true,
    15                    isWritablePrimary: false,
    16                    secondary: true,
    17                    setName: "rs",
    18                    hosts: ["a:27017", "b:27017"],
    19                    minWireVersion: 0,
    20                    maxWireVersion: 6
    21                }]
    22        ],
    23
    24        outcome: {
    25
    26            servers: {
    27
    28                "a:27017": {
    29
    30                    type: "RSSecondary",
    31                    setName: "rs"
    32                },
    33
    34                "b:27017": {
    35
    36                    type: "Unknown",
    37                    setName:
    38                }
    39            },
    40            topologyType: "ReplicaSetNoPrimary",
    41            logicalSessionTimeoutMinutes: null,
    42            setName: "rs"
    43        }
    44    },
    45
    46    # b is the primary.
    47    {
    48        responses: [
    49
    50                ["b:27017", {
    51
    52                    ok: 1,
    53                    helloOk: true,
    54                    isWritablePrimary: true,
    55                    setName: "rs",
    56                    hosts: ["a:27017", "b:27017"],
    57                    minWireVersion: 0,
    58                    maxWireVersion: 6
    59                }]
    60        ],
    61
    62        outcome: {
    63
    64            servers: {
    65
    66                "a:27017": {
    67
    68                    type: "RSSecondary",
    69                    setName: "rs"
    70                },
    71
    72                "b:27017": {
    73
    74                    type: "RSPrimary",
    75                    setName: "rs"
    76                }
    77            },
    78            topologyType: "ReplicaSetWithPrimary",
    79            logicalSessionTimeoutMinutes: null,
    80            setName: "rs"
    81        }
    82    },
    83
    84    # Admin adds a secondary member c.
    85    {
    86        responses: [
    87
    88                ["b:27017", {
    89
    90                    ok: 1,
    91                    helloOk: true,
    92                    isWritablePrimary: true,
    93                    setName: "rs",
    94                    hosts: ["a:27017", "b:27017", "c:27017"],
    95                    minWireVersion: 0,
    96                    maxWireVersion: 6
    97                }]
    98        ],
    99
   100        outcome: {
   101
   102            # c is new.
   103            servers: {
   104
   105                "a:27017": {
   106
   107                    type: "RSSecondary",
   108                    setName: "rs"
   109                },
   110
   111                "b:27017": {
   112
   113                    type: "RSPrimary",
   114                    setName: "rs"
   115                },
   116
   117                "c:27017": {
   118
   119                    type: "Unknown",
   120                    setName:
   121                }
   122            },
   123            topologyType: "ReplicaSetWithPrimary",
   124            logicalSessionTimeoutMinutes: null,
   125            setName: "rs"
   126        }
   127    },
   128
   129    # c becomes secondary.
   130    {
   131        responses: [
   132
   133                ["c:27017", {
   134
   135                    ok: 1,
   136                    helloOk: true,
   137                    isWritablePrimary: false,
   138                    secondary: true,
   139                    setName: "rs",
   140                    primary: "b:27017",
   141                    hosts: ["a:27017", "b:27017", "c:27017"],
   142                    minWireVersion: 0,
   143                    maxWireVersion: 6
   144                }]
   145        ],
   146
   147        outcome: {
   148
   149            # c is a secondary.
   150            servers: {
   151
   152                "a:27017": {
   153
   154                    type: "RSSecondary",
   155                    setName: "rs"
   156                },
   157
   158                "b:27017": {
   159
   160                    type: "RSPrimary",
   161                    setName: "rs"
   162                },
   163
   164                "c:27017": {
   165
   166                    type: "RSSecondary",
   167                    setName: "rs"
   168                }
   169            },
   170            topologyType: "ReplicaSetWithPrimary",
   171            logicalSessionTimeoutMinutes: null,
   172            setName: "rs"
   173        }
   174    }
   175]

View as plain text