@@ -21,6 +21,91 @@ The following tests have not yet been automated, but MUST still be tested:
21
21
5 . When a check out attempt fails because connection set up throws an error, assert that a ConnectionCheckOutFailedEvent
22
22
with reason="connectionError" is emitted.
23
23
24
+ ### Pending Response
25
+
26
+ If a connection with a pending response is idle for > 3 seconds, then drivers are expected to perform an aliveness check
27
+ by attempting a non-blocking read of 1 byte from the inbound TCP buffer. The following two cases test both a successful
28
+ read and a failed one.
29
+
30
+ Due to the complexity of managing a proxy layer, the following qualifying tests should only be run for non-ssl,
31
+ non-auth, and non-compression connections.
32
+
33
+ #### Recover Partial Header Response
34
+
35
+ This test verifies that if only part of a response header arrives before a socket timeout, the driver can drain the rest
36
+ of the response and reuse the connection for the next operation.
37
+
38
+ 1 . Connect to the proxy server with ` maxPoolSize=1 ` and ` direct=true ` , subscribing to the following CMAP events:
39
+ - ` PendingResponseStarted `
40
+ - ` PendingResponseSucceeded `
41
+ - ` PendingResponseFailed `
42
+ - ` ConnectionClosed `
43
+ 2 . Send a command (e.g. an insert) with a 200 millisecond timeout and the following ` proxyTest ` actions:
44
+ - ` sendBytes ` : any value between 1 and 3
45
+ - ` delayMS ` : 400 ( to exceed the 200 ms timeout)
46
+ - ` sendAll ` : ` true `
47
+ 3 . Issue any follow-up operation and assert that it does not return an error.
48
+ 4 . Verify that we've received the following events from the ` insertOne ` step:
49
+ - 1x` ConnectionPendingResponseStarted `
50
+ - 0x` ConnectionPendingResponseFailed `
51
+ - 1x` ConnectionPendingResponseSucceeded `
52
+ - 0x` ConnectionClosed `
53
+
54
+ #### Recover Partial Body Response
55
+
56
+ This test verifies that if only part of a response body arrives before a socket timeout, the driver can drain the rest
57
+ of the response and reuse the connection for the next operation.
58
+
59
+ 1 . Connect to the proxy server with ` maxPoolSize=1 ` and ` direct=true ` , subscribing to the following CMAP events:
60
+ - ` PendingResponseStarted `
61
+ - ` PendingResponseSucceeded `
62
+ - ` PendingResponseFailed `
63
+ - ` ConnectionClosed `
64
+ 2 . Send a command (e.g. an insert) with a 200 millisecond timeout and the following ` proxyTest ` actions:
65
+ - ` sendBytes ` : Any value > 16
66
+ - ` delayMS ` : 400 ( to exceed the 200 ms timeout)
67
+ - ` sendAll ` : ` true `
68
+ 3 . Issue any follow-up operation and assert that it does not return an error.
69
+ 4 . Verify that we've received the following events from the ` insertOne ` step:
70
+ - 1x` ConnectionPendingResponseStarted `
71
+ - 0x` ConnectionPendingResponseFailed `
72
+ - 1x` ConnectionPendingResponseSucceeded `
73
+ - 0x` ConnectionClosed `
74
+
75
+ #### Non-destructive Aliveness Check
76
+
77
+ This test verifies that if a connection idles past the driver's aliveness window (3 seconds) after a partial header, the
78
+ aliveness check does not attempt to discard bytes from the TCP stream.
79
+
80
+ 1 . Connect to the proxy server with ` maxPoolSize=1 ` and ` direct=true ` , subscribing to the following CMAP events:
81
+ - ` PendingResponseStarted `
82
+ - ` PendingResponseSucceeded `
83
+ - ` PendingResponseFailed `
84
+ - ` ConnectionClosed `
85
+ 2 . Send a command (e.g. an insert) with a 200 millisecond timeout and the following ` proxyTest ` actions:
86
+ - ` sendBytes ` : any value between 1 and 3
87
+ - ` delayMS ` : 400 ( to exceed the 200 ms timeout)
88
+ - ` sendAll ` : ` true `
89
+ 3 . Sleep for 3 seconds
90
+ 4 . Issue any follow-up operation and assert that it does not return an error.
91
+ 5 . Verify that we've received the following events from the ` insertOne ` step:
92
+ - 2x` ConnectionPendingResponseStarted `
93
+ - 1x` ConnectionPendingResponseFailed `
94
+ - 1x` ConnectionPendingResponseSucceeded `
95
+ - 0x` ConnectionClosed `
96
+
97
+ #### Exhaust Cursors
98
+
99
+ Drivers that support the ` exhaustAllowed ` ` OP_MSG ` bit flag must ensure that responses which contain ` moreToCome ` will
100
+ not result in a connection being put into a "pending response" state. Drivers that don't support this behavior can skip
101
+ this prose test.
102
+
103
+ 1 . Configure a failpoint to block ` getMore ` for 500ms.
104
+ 2 . Insert > 2 records into the collection.
105
+ 3 . Create an exhaust cursor using ` find ` and iterate one ` getMore ` using ` batchSize=1 ` .
106
+ 4 . Call a subsequent ` getMore ` on the exhaust cursor with a client-side timeout of 100ms.
107
+ 5 . Ensure that the ` ConnectionClosed ` event is emitted due to timeout.
108
+
24
109
## Logging Tests
25
110
26
111
Tests for connection pool logging can be found in the ` /logging ` subdirectory and are written in the
0 commit comments