Skip to content

Commit 6118deb

Browse files
authored
DRIVERS-3130 Test wait queue timeout errors do not clear the pool (#1768)
1 parent 0aee4aa commit 6118deb

File tree

2 files changed

+281
-0
lines changed

2 files changed

+281
-0
lines changed

source/client-side-operations-timeout/tests/waitQueueTimeout.json

Lines changed: 176 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
description: "WaitQueueTimeoutError does not clear the pool"
2+
3+
schemaVersion: "1.9"
4+
5+
runOnRequirements:
6+
- minServerVersion: "4.4"
7+
topologies: ["single", "replicaset", "sharded"]
8+
9+
createEntities:
10+
- client:
11+
id: &failPointClient failPointClient
12+
useMultipleMongoses: false
13+
- client:
14+
id: &client client
15+
uriOptions:
16+
maxPoolSize: 1
17+
appname: &appname waitQueueTimeoutErrorTest
18+
useMultipleMongoses: false
19+
observeEvents:
20+
- commandStartedEvent
21+
- poolClearedEvent
22+
- database:
23+
id: &database database
24+
client: *client
25+
databaseName: &databaseName test
26+
27+
tests:
28+
- description: "WaitQueueTimeoutError does not clear the pool"
29+
operations:
30+
- name: failPoint
31+
object: testRunner
32+
arguments:
33+
client: *failPointClient
34+
failPoint:
35+
configureFailPoint: failCommand
36+
mode: { times: 1 }
37+
data:
38+
failCommands: ["ping"]
39+
blockConnection: true
40+
blockTimeMS: 500
41+
appName: *appname
42+
# Start thread.
43+
- name: createEntities
44+
object: testRunner
45+
arguments:
46+
entities:
47+
- thread:
48+
id: &thread0 thread0
49+
- name: runOnThread
50+
object: testRunner
51+
arguments:
52+
thread: *thread0
53+
operation:
54+
name: runCommand
55+
object: *database
56+
arguments:
57+
command: { ping: 1 }
58+
commandName: ping
59+
# Wait for the thread to checkout the only connection (maxPoolSize=1).
60+
- name: waitForEvent
61+
object: testRunner
62+
arguments:
63+
client: *client
64+
event:
65+
commandStartedEvent:
66+
commandName: ping
67+
count: 1
68+
# Run another command with a short timeout to make it likely to get a WaitQueueTimeoutError.
69+
- name: runCommand
70+
object: *database
71+
arguments:
72+
timeoutMS: 100
73+
command: { hello: 1 }
74+
commandName: hello
75+
expectError:
76+
isTimeoutError: true
77+
- name: waitForThread
78+
object: testRunner
79+
arguments:
80+
thread: *thread0
81+
# Run another command with no timeout to ensure the pool is not cleared.
82+
- name: runCommand
83+
object: *database
84+
arguments:
85+
command: { hello: 1 }
86+
commandName: hello
87+
88+
expectEvents:
89+
- client: *client
90+
eventType: command
91+
events:
92+
- commandStartedEvent:
93+
commandName: ping
94+
databaseName: *databaseName
95+
command:
96+
ping: 1
97+
- commandStartedEvent:
98+
commandName: hello
99+
databaseName: *databaseName
100+
command:
101+
hello: 1
102+
# No poolClearedEvent.
103+
- client: *client
104+
eventType: cmap
105+
events: []

0 commit comments

Comments
 (0)