Skip to content

Commit 92e5f28

Browse files
committed
RUBY-912 Update null electionId test
1 parent 7c09d78 commit 92e5f28

File tree

1 file changed

+57
-10
lines changed

1 file changed

+57
-10
lines changed

spec/support/sdam/rs/null_election_id.yml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: "Primary with no electionId, then a primary with electionId"
1+
description: "Primaries with and without electionIds"
22

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

@@ -10,7 +10,7 @@ phases: [
1010
["a:27017", {
1111
ok: 1,
1212
ismaster: true,
13-
hosts: ["a:27017", "b:27017"],
13+
hosts: ["a:27017", "b:27017", "c:27017"],
1414
setName: "rs"
1515
}]
1616
],
@@ -26,11 +26,15 @@ phases: [
2626
type: "Unknown",
2727
setName: ,
2828
electionId:
29+
},
30+
"c:27017": {
31+
type: "Unknown",
32+
setName: ,
33+
electionId:
2934
}
3035
},
3136
topologyType: "ReplicaSetWithPrimary",
3237
setName: "rs",
33-
maxElectionId:
3438
}
3539
},
3640

@@ -40,9 +44,9 @@ phases: [
4044
["b:27017", {
4145
ok: 1,
4246
ismaster: true,
43-
hosts: ["a:27017", "b:27017"],
47+
hosts: ["a:27017", "b:27017", "c:27017"],
4448
setName: "rs",
45-
electionId: {"$oid": "000000000000000000000001"}
49+
electionId: {"$oid": "000000000000000000000002"}
4650
}]
4751
],
4852

@@ -56,12 +60,16 @@ phases: [
5660
"b:27017": {
5761
type: "RSPrimary",
5862
setName: "rs",
59-
electionId: {"$oid": "000000000000000000000001"}
63+
electionId: {"$oid": "000000000000000000000002"}
64+
},
65+
"c:27017": {
66+
type: "Unknown",
67+
setName: ,
68+
electionId:
6069
}
6170
},
6271
topologyType: "ReplicaSetWithPrimary",
6372
setName: "rs",
64-
maxElectionId: {"$oid": "000000000000000000000001"}
6573
}
6674
},
6775

@@ -71,7 +79,7 @@ phases: [
7179
["a:27017", {
7280
ok: 1,
7381
ismaster: true,
74-
hosts: ["a:27017", "b:27017"],
82+
hosts: ["a:27017", "b:27017", "c:27017"],
7583
setName: "rs"
7684
}]
7785
],
@@ -86,12 +94,51 @@ phases: [
8694
type: "Unknown",
8795
setName: ,
8896
electionId:
97+
},
98+
"c:27017": {
99+
type: "Unknown",
100+
setName: ,
101+
electionId:
102+
}
103+
},
104+
topologyType: "ReplicaSetWithPrimary",
105+
setName: "rs",
106+
}
107+
},
108+
109+
# But we remember A's electionId, so when we finally hear from C
110+
# claiming it is primary, we ignore it due to its outdated electionId
111+
{
112+
responses: [
113+
["c:27017", {
114+
ok: 1,
115+
ismaster: true,
116+
hosts: ["a:27017", "b:27017", "c:27017"],
117+
setName: "rs",
118+
electionId: {"$oid": "000000000000000000000001"}
119+
}]
120+
],
121+
outcome: {
122+
servers: {
123+
# Still primary.
124+
"a:27017": {
125+
type: "RSPrimary",
126+
setName: "rs",
127+
electionId:
128+
},
129+
"b:27017": {
130+
type: "Unknown",
131+
setName: ,
132+
electionId:
133+
},
134+
"c:27017": {
135+
type: "Unknown",
136+
setName: ,
137+
electionId:
89138
}
90139
},
91140
topologyType: "ReplicaSetWithPrimary",
92141
setName: "rs",
93-
# But we remember old electionId.
94-
maxElectionId: {"$oid": "000000000000000000000001"}
95142
}
96143
}
97144
]

0 commit comments

Comments
 (0)