forked from mongodb/specifications
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDAM test: primary steps down and changes setName.
Noticed a bug in C Driver's updateRSWithPrimaryFromMember that wasn't revealed by any SDAM test: 1. Discover primary, topology type is ReplicaSetWithPrimary 2. In next ismaster response from primary it has become secondary *and* changed setName Expected: server removed, topology type changes to ReplicaSetNoPrimary Actual: server removed but topology type remains ReplicaSetWithPrimary
- Loading branch information
Showing
2 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
source/server-discovery-and-monitoring/tests/rs/stepdown_change_set_name.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"description": "Primary becomes a secondary with wrong setName", | ||
"phases": [ | ||
{ | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"setName": "rs", | ||
"type": "RSPrimary" | ||
} | ||
}, | ||
"setName": "rs", | ||
"topologyType": "ReplicaSetWithPrimary" | ||
}, | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"hosts": [ | ||
"a:27017" | ||
], | ||
"ismaster": true, | ||
"ok": 1, | ||
"setName": "rs" | ||
} | ||
] | ||
] | ||
}, | ||
{ | ||
"outcome": { | ||
"servers": {}, | ||
"setName": "rs", | ||
"topologyType": "ReplicaSetNoPrimary" | ||
}, | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"hosts": [ | ||
"a:27017" | ||
], | ||
"ismaster": false, | ||
"ok": 1, | ||
"secondary": true, | ||
"setName": "wrong" | ||
} | ||
] | ||
] | ||
} | ||
], | ||
"uri": "mongodb://a/?replicaSet=rs" | ||
} |
59 changes: 59 additions & 0 deletions
59
source/server-discovery-and-monitoring/tests/rs/stepdown_change_set_name.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
description: "Primary becomes a secondary with wrong setName" | ||
|
||
uri: "mongodb://a/?replicaSet=rs" | ||
|
||
phases: [ | ||
|
||
# Primary is discovered normally. | ||
{ | ||
responses: [ | ||
|
||
["a:27017", { | ||
|
||
ok: 1, | ||
ismaster: true, | ||
hosts: ["a:27017"], | ||
setName: "rs" | ||
}] | ||
], | ||
|
||
outcome: { | ||
|
||
servers: { | ||
|
||
"a:27017": { | ||
|
||
type: "RSPrimary", | ||
setName: "rs" | ||
} | ||
}, | ||
|
||
topologyType: "ReplicaSetWithPrimary", | ||
setName: "rs" | ||
} | ||
}, | ||
|
||
# Primary changes its setName and becomes secondary. | ||
# Remove it and change the topologyType. | ||
{ | ||
responses: [ | ||
|
||
["a:27017", { | ||
|
||
ok: 1, | ||
ismaster: false, | ||
secondary: true, | ||
hosts: ["a:27017"], | ||
setName: "wrong" | ||
}] | ||
], | ||
|
||
outcome: { | ||
|
||
servers: {}, | ||
|
||
topologyType: "ReplicaSetNoPrimary", | ||
setName: "rs" | ||
} | ||
} | ||
] |