description: "Primary reports a new member"

uri: "mongodb://a/?replicaSet=rs"

phases: [

    # At first, a is a secondary.
    {
        responses: [

                ["a:27017", {

                    ok: 1,
                    ismaster: false,
                    secondary: true,
                    setName: "rs",
                    hosts: ["a:27017", "b:27017"],
                    minWireVersion: 0,
                    maxWireVersion: 6
                }]
        ],

        outcome: {

            servers: {

                "a:27017": {

                    type: "RSSecondary",
                    setName: "rs"
                },

                "b:27017": {

                    type: "Unknown",
                    setName:
                }
            },
            topologyType: "ReplicaSetNoPrimary",
            logicalSessionTimeoutMinutes: null,
            setName: "rs"
        }
    },

    # b is the primary.
    {
        responses: [

                ["b:27017", {

                    ok: 1,
                    ismaster: true,
                    setName: "rs",
                    hosts: ["a:27017", "b:27017"],
                    minWireVersion: 0,
                    maxWireVersion: 6
                }]
        ],

        outcome: {

            servers: {

                "a:27017": {

                    type: "RSSecondary",
                    setName: "rs"
                },

                "b:27017": {

                    type: "RSPrimary",
                    setName: "rs"
                }
            },
            topologyType: "ReplicaSetWithPrimary",
            logicalSessionTimeoutMinutes: null,
            setName: "rs"
        }
    },

    # Admin adds a secondary member c.
    {
        responses: [

                ["b:27017", {

                    ok: 1,
                    ismaster: true,
                    setName: "rs",
                    hosts: ["a:27017", "b:27017", "c:27017"],
                    minWireVersion: 0,
                    maxWireVersion: 6
                }]
        ],

        outcome: {

            # c is new.
            servers: {

                "a:27017": {

                    type: "RSSecondary",
                    setName: "rs"
                },

                "b:27017": {

                    type: "RSPrimary",
                    setName: "rs"
                },

                "c:27017": {

                    type: "Unknown",
                    setName:
                }
            },
            topologyType: "ReplicaSetWithPrimary",
            logicalSessionTimeoutMinutes: null,
            setName: "rs"
        }
    },

    # c becomes secondary.
    {
        responses: [

                ["c:27017", {

                    ok: 1,
                    ismaster: false,
                    secondary: true,
                    setName: "rs",
                    primary: "b:27017",
                    hosts: ["a:27017", "b:27017", "c:27017"],
                    minWireVersion: 0,
                    maxWireVersion: 6
                }]
        ],

        outcome: {

            # c is a secondary.
            servers: {

                "a:27017": {

                    type: "RSSecondary",
                    setName: "rs"
                },

                "b:27017": {

                    type: "RSPrimary",
                    setName: "rs"
                },

                "c:27017": {

                    type: "RSSecondary",
                    setName: "rs"
                }
            },
            topologyType: "ReplicaSetWithPrimary",
            logicalSessionTimeoutMinutes: null,
            setName: "rs"
        }
    }
]
