Skip to content

Commit

Permalink
chore: add spec changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Sep 8, 2021
1 parent 44df7d7 commit 2e19107
Show file tree
Hide file tree
Showing 387 changed files with 5,270 additions and 901 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ phases:
responses:
- - a:27017
- ok: 1
ismaster: true
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def write_test(filename, data):
ERR_CODES = {
'InterruptedAtShutdown': (11600,),
'InterruptedDueToReplStateChange': (11602,),
'NotMasterOrSecondary': (13436,),
'NotPrimaryOrSecondary': (13436,),
'PrimarySteppedDown': (189,),
'ShutdownInProgress': (91,),
'NotMaster': (10107,),
'NotMasterNoSlaveOk': (13435,),
'NotWritablePrimary': (10107,),
'NotPrimaryNoSecondaryOk': (13435,),
'LegacyNotPrimary': (10058,),
}


Expand Down Expand Up @@ -129,6 +130,7 @@ def create_stale_generation_tests():
# Stale network errors
for network_error_type, when in itertools.product(
['network', 'timeout'], WHEN):
error_name = network_error_type
test_name = f'stale-generation-{when}-{network_error_type}'
stale_error = STALE_GENERATION_NETWORK_ERROR.format(**locals())
data = tmp.format(**locals())
Expand All @@ -137,7 +139,7 @@ def create_stale_generation_tests():

def create_pre_42_tests():
tmp = template('pre-42.yml.template')
# All "not master"/"node is recovering" clear the pool on <4.2
# All "not writable primary"/"node is recovering" clear the pool on <4.2
for error_name in ERR_CODES:
test_name = f'pre-42-{error_name}'
error_code, = ERR_CODES[error_name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ phases:
responses:
- - a:27017
- ok: 1
ismaster: true
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ phases:
responses:
- - a:27017
- ok: 1
ismaster: true
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ phases:
responses:
- - a:27017
- ok: 1
ismaster: true
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ phases:
responses:
- - a:27017
- ok: 1
ismaster: true
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"description": "Non-stale topologyVersion greater LegacyNotPrimary error",
"uri": "mongodb://a/?replicaSet=rs",
"phases": [
{
"description": "Primary A is discovered",
"responses": [
[
"a:27017",
{
"ok": 1,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
"setName": "rs",
"minWireVersion": 0,
"maxWireVersion": 9,
"topologyVersion": {
"processId": {
"$oid": "000000000000000000000001"
},
"counter": {
"$numberLong": "1"
}
}
}
]
],
"outcome": {
"servers": {
"a:27017": {
"type": "RSPrimary",
"setName": "rs",
"topologyVersion": {
"processId": {
"$oid": "000000000000000000000001"
},
"counter": {
"$numberLong": "1"
}
},
"pool": {
"generation": 0
}
}
},
"topologyType": "ReplicaSetWithPrimary",
"logicalSessionTimeoutMinutes": null,
"setName": "rs"
}
},
{
"description": "Non-stale topologyVersion greater LegacyNotPrimary error marks server Unknown",
"applicationErrors": [
{
"address": "a:27017",
"when": "afterHandshakeCompletes",
"maxWireVersion": 9,
"type": "command",
"response": {
"ok": 0,
"errmsg": "LegacyNotPrimary",
"code": 10058,
"topologyVersion": {
"processId": {
"$oid": "000000000000000000000001"
},
"counter": {
"$numberLong": "2"
}
}
}
}
],
"outcome": {
"servers": {
"a:27017": {
"type": "Unknown",
"topologyVersion": {
"processId": {
"$oid": "000000000000000000000001"
},
"counter": {
"$numberLong": "2"
}
},
"pool": {
"generation": 0
}
}
},
"topologyType": "ReplicaSetNoPrimary",
"logicalSessionTimeoutMinutes": null,
"setName": "rs"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Autogenerated tests for SDAM error handling, see generate-error-tests.py
description: Non-stale topologyVersion greater LegacyNotPrimary error
uri: mongodb://a/?replicaSet=rs
phases:
- description: Primary A is discovered
responses:
- - a:27017
- ok: 1
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
minWireVersion: 0
maxWireVersion: 9
topologyVersion: &topologyVersion_1_1
processId:
"$oid": '000000000000000000000001'
counter:
"$numberLong": '1'
outcome: &outcome
servers:
a:27017:
type: RSPrimary
setName: rs
topologyVersion: *topologyVersion_1_1
pool:
generation: 0
topologyType: ReplicaSetWithPrimary
logicalSessionTimeoutMinutes: null
setName: rs

- description: Non-stale topologyVersion greater LegacyNotPrimary error marks server Unknown
applicationErrors:
- address: a:27017
when: afterHandshakeCompletes
maxWireVersion: 9
type: command
response:
ok: 0
errmsg: LegacyNotPrimary
code: 10058
topologyVersion:
processId:
"$oid": '000000000000000000000001'
counter:
"$numberLong": "2"
outcome:
servers:
a:27017:
type: Unknown
topologyVersion:
processId:
"$oid": '000000000000000000000001'
counter:
"$numberLong": "2"
pool:
generation: 0
topologyType: ReplicaSetNoPrimary
logicalSessionTimeoutMinutes: null
setName: rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "Non-stale topologyVersion greater NotMasterNoSlaveOk error",
"description": "Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error",
"uri": "mongodb://a/?replicaSet=rs",
"phases": [
{
Expand All @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down Expand Up @@ -51,7 +52,7 @@
}
},
{
"description": "Non-stale topologyVersion greater NotMasterNoSlaveOk error marks server Unknown",
"description": "Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error marks server Unknown",
"applicationErrors": [
{
"address": "a:27017",
Expand All @@ -60,7 +61,7 @@
"type": "command",
"response": {
"ok": 0,
"errmsg": "NotMasterNoSlaveOk",
"errmsg": "NotPrimaryNoSecondaryOk",
"code": 13435,
"topologyVersion": {
"processId": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Autogenerated tests for SDAM error handling, see generate-error-tests.py
description: Non-stale topologyVersion greater NotMasterNoSlaveOk error
description: Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error
uri: mongodb://a/?replicaSet=rs
phases:
- description: Primary A is discovered
responses:
- - a:27017
- ok: 1
ismaster: true
helloOk: true
isWritablePrimary: true
hosts:
- a:27017
setName: rs
Expand All @@ -29,15 +30,15 @@ phases:
logicalSessionTimeoutMinutes: null
setName: rs

- description: Non-stale topologyVersion greater NotMasterNoSlaveOk error marks server Unknown
- description: Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error marks server Unknown
applicationErrors:
- address: a:27017
when: afterHandshakeCompletes
maxWireVersion: 9
type: command
response:
ok: 0
errmsg: NotMasterNoSlaveOk
errmsg: NotPrimaryNoSecondaryOk
code: 13435
topologyVersion:
processId:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "Non-stale topologyVersion greater NotMasterOrSecondary error",
"description": "Non-stale topologyVersion greater NotPrimaryOrSecondary error",
"uri": "mongodb://a/?replicaSet=rs",
"phases": [
{
Expand All @@ -9,7 +9,8 @@
"a:27017",
{
"ok": 1,
"ismaster": true,
"helloOk": true,
"isWritablePrimary": true,
"hosts": [
"a:27017"
],
Expand Down Expand Up @@ -51,7 +52,7 @@
}
},
{
"description": "Non-stale topologyVersion greater NotMasterOrSecondary error marks server Unknown",
"description": "Non-stale topologyVersion greater NotPrimaryOrSecondary error marks server Unknown",
"applicationErrors": [
{
"address": "a:27017",
Expand All @@ -60,7 +61,7 @@
"type": "command",
"response": {
"ok": 0,
"errmsg": "NotMasterOrSecondary",
"errmsg": "NotPrimaryOrSecondary",
"code": 13436,
"topologyVersion": {
"processId": {
Expand Down
Loading

0 comments on commit 2e19107

Please sign in to comment.