Skip to content

Commit 2a594d5

Browse files
SPEC-1393 Connections survive primary step-down tests should always test for success (#627)
1 parent 95b93c6 commit 2a594d5

File tree

1 file changed

+18
-1
lines changed
  • source/connections-survive-step-down/tests

1 file changed

+18
-1
lines changed

source/connections-survive-step-down/tests/README.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ This test requires a replica set with server version 4.0.
121121
document.
122122
- Verify that the insert failed with an operation failure with 10107 code.
123123
- Verify that the pool has been cleared following the instructions in section `How to verify the connection pool has been cleared`_
124+
- Execute an insert into the test collection of a ``{test: 1}``
125+
document and verify that it succeeds.
124126

125127

126128
Shutdown in progress - Reset Connection Pool
@@ -136,6 +138,8 @@ Perform the following operations on a client configured to NOT retry writes:
136138
document.
137139
- Verify that the insert failed with an operation failure with 91 code.
138140
- Verify that the pool has been cleared following the instructions in section `How to verify the connection pool has been cleared`_
141+
- Execute an insert into the test collection of a ``{test: 1}``
142+
document and verify that it succeeds.
139143

140144

141145
Interrupted at shutdown - Reset Connection Pool
@@ -151,13 +155,26 @@ Perform the following operations on a client configured to NOT retry writes:
151155
document.
152156
- Verify that the insert failed with an operation failure with 11600 code.
153157
- Verify that the pool has been cleared following the instructions in section `How to verify the connection pool has been cleared`_
158+
- Execute an insert into the test collection of a ``{test: 1}``
159+
document and verify that it succeeds.
154160

155161

156162

157163
Questions and Answers
158164
---------------------
159165

160166
Do we need to wait for re-election after the first test?
161-
``````````````````````````````````````````````````````````
167+
````````````````````````````````````````````````````````
162168

163169
Since test setup requires creation of a collection, a primary must exist, so subsequent tests will block in server selection until a primary is available again.
170+
171+
172+
Why do tests check for a successful insert operation in addition to checking that the pool was updated appropriately?
173+
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
174+
175+
Ensuring that we can run a successful insert after the primary steps down and without needing to recreate the
176+
``MongoClient`` serves to test the resiliency of drivers in the event of a failover/election. Even though checking for
177+
a successful insert operation does not directly test functionality introduced in this specification, it is a
178+
straightforward way to test driver resiliency against a live replica set undergoing an election. This testing
179+
methodology is in contrast to the one adopted by the SDAM spec tests that rely entirely on mocking with no actual
180+
server communication.

0 commit comments

Comments
 (0)