Skip to content

Commit c529d43

Browse files
authored
test(NODE-3070): Ensure that SDAM should ignore the writeErrors field (#2768)
1 parent a928594 commit c529d43

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"description": "writeErrors field is ignored",
3+
"uri": "mongodb://a/?replicaSet=rs",
4+
"phases": [
5+
{
6+
"description": "Primary A is discovered",
7+
"responses": [
8+
[
9+
"a:27017",
10+
{
11+
"ok": 1,
12+
"ismaster": true,
13+
"hosts": [
14+
"a:27017"
15+
],
16+
"setName": "rs",
17+
"minWireVersion": 0,
18+
"maxWireVersion": 9,
19+
"topologyVersion": {
20+
"processId": {
21+
"$oid": "000000000000000000000001"
22+
},
23+
"counter": {
24+
"$numberLong": "1"
25+
}
26+
}
27+
}
28+
]
29+
],
30+
"outcome": {
31+
"servers": {
32+
"a:27017": {
33+
"type": "RSPrimary",
34+
"setName": "rs",
35+
"topologyVersion": {
36+
"processId": {
37+
"$oid": "000000000000000000000001"
38+
},
39+
"counter": {
40+
"$numberLong": "1"
41+
}
42+
},
43+
"pool": {
44+
"generation": 0
45+
}
46+
}
47+
},
48+
"topologyType": "ReplicaSetWithPrimary",
49+
"logicalSessionTimeoutMinutes": null,
50+
"setName": "rs"
51+
}
52+
},
53+
{
54+
"description": "Ignore command error with writeErrors field",
55+
"applicationErrors": [
56+
{
57+
"address": "a:27017",
58+
"when": "afterHandshakeCompletes",
59+
"maxWireVersion": 9,
60+
"type": "command",
61+
"response": {
62+
"ok": 1,
63+
"writeErrors": [
64+
{
65+
"errmsg": "NotMasterNoSlaveOk",
66+
"code": 13435
67+
}
68+
]
69+
}
70+
}
71+
],
72+
"outcome": {
73+
"servers": {
74+
"a:27017": {
75+
"type": "RSPrimary",
76+
"setName": "rs",
77+
"topologyVersion": {
78+
"processId": {
79+
"$oid": "000000000000000000000001"
80+
},
81+
"counter": {
82+
"$numberLong": "1"
83+
}
84+
},
85+
"pool": {
86+
"generation": 0
87+
}
88+
}
89+
},
90+
"topologyType": "ReplicaSetWithPrimary",
91+
"logicalSessionTimeoutMinutes": null,
92+
"setName": "rs"
93+
}
94+
}
95+
]
96+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
description: writeErrors field is ignored
2+
uri: mongodb://a/?replicaSet=rs
3+
phases:
4+
- description: Primary A is discovered
5+
responses:
6+
- - a:27017
7+
- ok: 1
8+
ismaster: true
9+
hosts:
10+
- a:27017
11+
setName: rs
12+
minWireVersion: 0
13+
maxWireVersion: 9
14+
topologyVersion: &topologyVersion_1_1
15+
processId:
16+
"$oid": '000000000000000000000001'
17+
counter:
18+
"$numberLong": '1'
19+
outcome: &outcome
20+
servers:
21+
a:27017:
22+
type: RSPrimary
23+
setName: rs
24+
topologyVersion: *topologyVersion_1_1
25+
pool:
26+
generation: 0
27+
topologyType: ReplicaSetWithPrimary
28+
logicalSessionTimeoutMinutes: null
29+
setName: rs
30+
31+
- description: Ignore command error with writeErrors field
32+
applicationErrors:
33+
- address: a:27017
34+
when: afterHandshakeCompletes
35+
maxWireVersion: 9
36+
type: command
37+
response:
38+
ok: 1
39+
writeErrors:
40+
- { errmsg: NotMasterNoSlaveOk, code: 13435 }
41+
outcome: *outcome

0 commit comments

Comments
 (0)