Skip to content

Commit 18ce806

Browse files
authored
test(NODE-4414): Improve reliability of SDAM heartbeat error spec tests (#3318)
1 parent 0754bf9 commit 18ce806

File tree

6 files changed

+45
-69
lines changed

6 files changed

+45
-69
lines changed

test/spec/server-discovery-and-monitoring/integration/hello-command-error.json

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"failPoint": {
118118
"configureFailPoint": "failCommand",
119119
"mode": {
120-
"times": 2
120+
"times": 4
121121
},
122122
"data": {
123123
"failCommands": [
@@ -162,22 +162,6 @@
162162
}
163163
]
164164
}
165-
},
166-
{
167-
"name": "assertEventCount",
168-
"object": "testRunner",
169-
"arguments": {
170-
"event": "ServerMarkedUnknownEvent",
171-
"count": 1
172-
}
173-
},
174-
{
175-
"name": "assertEventCount",
176-
"object": "testRunner",
177-
"arguments": {
178-
"event": "PoolClearedEvent",
179-
"count": 1
180-
}
181165
}
182166
],
183167
"expectations": [

test/spec/server-discovery-and-monitoring/integration/hello-command-error.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ tests:
8484
documents:
8585
- _id: 1
8686
- _id: 2
87-
# Configure the next streaming hello check to fail with a command
88-
# error.
89-
# Use times: 2 so that the RTT hello is blocked as well.
87+
# Configure the next streaming hello check to fail with a command error.
88+
# Use "times: 4" to increase the probability that the Monitor check fails
89+
# since the RTT hello may trigger this failpoint one or many times as
90+
# well.
9091
- name: configureFailPoint
9192
object: testRunner
9293
arguments:
9394
failPoint:
9495
configureFailPoint: failCommand
95-
mode: { times: 2 }
96+
mode: { times: 4 }
9697
data:
9798
failCommands: ["hello", "isMaster"]
9899
appName: commandErrorCheckTest
@@ -119,17 +120,19 @@ tests:
119120
documents:
120121
- _id: 3
121122
- _id: 4
122-
# Assert the server was marked Unknown and pool was cleared exactly once.
123-
- name: assertEventCount
124-
object: testRunner
125-
arguments:
126-
event: ServerMarkedUnknownEvent
127-
count: 1
128-
- name: assertEventCount
129-
object: testRunner
130-
arguments:
131-
event: PoolClearedEvent
132-
count: 1
123+
# We cannot assert the server was marked Unknown and pool was cleared an
124+
# exact number of times because the RTT hello may have triggered this
125+
# failpoint one or many times as well.
126+
# - name: assertEventCount
127+
# object: testRunner
128+
# arguments:
129+
# event: ServerMarkedUnknownEvent
130+
# count: 1
131+
# - name: assertEventCount
132+
# object: testRunner
133+
# arguments:
134+
# event: PoolClearedEvent
135+
# count: 1
133136

134137
expectations:
135138
- command_started_event:

test/spec/server-discovery-and-monitoring/integration/hello-network-error.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"failPoint": {
117117
"configureFailPoint": "failCommand",
118118
"mode": {
119-
"times": 2
119+
"times": 4
120120
},
121121
"data": {
122122
"failCommands": [

test/spec/server-discovery-and-monitoring/integration/hello-network-error.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@ tests:
8484
- _id: 1
8585
- _id: 2
8686
# Configure the next streaming hello check to fail with a non-timeout
87-
# network error. Use times: 2 to ensure that the the Monitor check fails
88-
# since the RTT hello may trigger this failpoint as well.
87+
# network error. Use "times: 4" to increase the probability that the
88+
# Monitor check fails since the RTT hello may trigger this failpoint one
89+
# or many times as well.
8990
- name: configureFailPoint
9091
object: testRunner
9192
arguments:
9293
failPoint:
9394
configureFailPoint: failCommand
94-
mode: { times: 2 }
95+
mode: { times: 4 }
9596
data:
9697
failCommands: ["hello", "isMaster"]
9798
appName: networkErrorCheckTest
@@ -116,8 +117,8 @@ tests:
116117
- _id: 3
117118
- _id: 4
118119
# We cannot assert the server was marked Unknown and pool was cleared an
119-
# exact number of times because the RTT hello may or may not have
120-
# triggered this failpoint as well.
120+
# exact number of times because the RTT hello may have triggered this
121+
# failpoint one or many times as well.
121122
# - name: assertEventCount
122123
# object: testRunner
123124
# arguments:

test/spec/server-discovery-and-monitoring/integration/hello-timeout.json

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"failPoint": {
118118
"configureFailPoint": "failCommand",
119119
"mode": {
120-
"times": 2
120+
"times": 4
121121
},
122122
"data": {
123123
"failCommands": [
@@ -160,22 +160,6 @@
160160
}
161161
]
162162
}
163-
},
164-
{
165-
"name": "assertEventCount",
166-
"object": "testRunner",
167-
"arguments": {
168-
"event": "ServerMarkedUnknownEvent",
169-
"count": 1
170-
}
171-
},
172-
{
173-
"name": "assertEventCount",
174-
"object": "testRunner",
175-
"arguments": {
176-
"event": "PoolClearedEvent",
177-
"count": 1
178-
}
179163
}
180164
],
181165
"expectations": [

test/spec/server-discovery-and-monitoring/integration/hello-timeout.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ tests:
8484
documents:
8585
- _id: 1
8686
- _id: 2
87-
# Configure the next streaming hello check to fail with a timeout
88-
# Use times: 2 so that the RTT hello is blocked as well.
87+
# Configure the next streaming hello check to fail with a timeout.
88+
# Use "times: 4" to increase the probability that the Monitor check times
89+
# out since the RTT hello may trigger this failpoint one or many times as
90+
# well.
8991
- name: configureFailPoint
9092
object: testRunner
9193
arguments:
9294
failPoint:
9395
configureFailPoint: failCommand
94-
mode: { times: 2 }
96+
mode: { times: 4 }
9597
data:
9698
failCommands: ["hello", "isMaster"]
9799
appName: timeoutMonitorCheckTest
@@ -119,17 +121,19 @@ tests:
119121
documents:
120122
- _id: 3
121123
- _id: 4
122-
# Assert the server was marked Unknown and pool was cleared exactly once.
123-
- name: assertEventCount
124-
object: testRunner
125-
arguments:
126-
event: ServerMarkedUnknownEvent
127-
count: 1
128-
- name: assertEventCount
129-
object: testRunner
130-
arguments:
131-
event: PoolClearedEvent
132-
count: 1
124+
# We cannot assert the server was marked Unknown and pool was cleared an
125+
# exact number of times because the RTT hello may have triggered this
126+
# failpoint one or many times as well.
127+
# - name: assertEventCount
128+
# object: testRunner
129+
# arguments:
130+
# event: ServerMarkedUnknownEvent
131+
# count: 1
132+
# - name: assertEventCount
133+
# object: testRunner
134+
# arguments:
135+
# event: PoolClearedEvent
136+
# count: 1
133137

134138
expectations:
135139
- command_started_event:

0 commit comments

Comments
 (0)